@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | return [ |
34 | 34 | 'drop' => [ |
35 | 35 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
36 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
36 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
37 | 37 | return $qb->dropForeignKey($name, $tableName); |
38 | 38 | }, |
39 | 39 | ], |
40 | 40 | 'add' => [ |
41 | 41 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] FOREIGN KEY ([[C_fk_id_1]])" |
42 | 42 | . " REFERENCES {{{$pkTableName}}} ([[C_id_1]]) ON DELETE CASCADE ON UPDATE CASCADE", |
43 | - static function (QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
43 | + static function(QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
44 | 44 | return $qb->addForeignKey( |
45 | 45 | $name, |
46 | 46 | $tableName, |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'add (2 columns)' => [ |
56 | 56 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] FOREIGN KEY ([[C_fk_id_1]], [[C_fk_id_2]])" |
57 | 57 | . " REFERENCES {{{$pkTableName}}} ([[C_id_1]], [[C_id_2]]) ON DELETE CASCADE ON UPDATE CASCADE", |
58 | - static function (QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
58 | + static function(QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
59 | 59 | return $qb->addForeignKey( |
60 | 60 | $name, |
61 | 61 | $tableName, |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | return [ |
79 | 79 | 'drop' => [ |
80 | 80 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
81 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
81 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
82 | 82 | return $qb->dropPrimaryKey($name, $tableName); |
83 | 83 | }, |
84 | 84 | ], |
85 | 85 | 'add' => [ |
86 | 86 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] PRIMARY KEY ([[C_id_1]])", |
87 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
87 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
88 | 88 | return $qb->addPrimaryKey($name, $tableName, 'C_id_1'); |
89 | 89 | }, |
90 | 90 | ], |
91 | 91 | 'add (2 columns)' => [ |
92 | 92 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] PRIMARY KEY ([[C_id_1]], [[C_id_2]])", |
93 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
93 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
94 | 94 | return $qb->addPrimaryKey($name, $tableName, 'C_id_1, C_id_2'); |
95 | 95 | }, |
96 | 96 | ], |
@@ -107,19 +107,19 @@ discard block |
||
107 | 107 | return [ |
108 | 108 | 'drop' => [ |
109 | 109 | "ALTER TABLE {{{$tableName1}}} DROP CONSTRAINT [[$name1]]", |
110 | - static function (QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
110 | + static function(QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
111 | 111 | return $qb->dropUnique($name1, $tableName1); |
112 | 112 | }, |
113 | 113 | ], |
114 | 114 | 'add' => [ |
115 | 115 | "ALTER TABLE {{{$tableName1}}} ADD CONSTRAINT [[$name1]] UNIQUE ([[C_unique]])", |
116 | - static function (QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
116 | + static function(QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
117 | 117 | return $qb->addUnique($name1, $tableName1, 'C_unique'); |
118 | 118 | }, |
119 | 119 | ], |
120 | 120 | 'add (2 columns)' => [ |
121 | 121 | "ALTER TABLE {{{$tableName2}}} ADD CONSTRAINT [[$name2]] UNIQUE ([[C_index_2_1]], [[C_index_2_2]])", |
122 | - static function (QueryBuilderInterface $qb) use ($tableName2, $name2) { |
|
122 | + static function(QueryBuilderInterface $qb) use ($tableName2, $name2) { |
|
123 | 123 | return $qb->addUnique($name2, $tableName2, 'C_index_2_1, C_index_2_2'); |
124 | 124 | }, |
125 | 125 | ], |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | [':qp0' => 1, |
504 | 504 | ':qp1' => 'foo', |
505 | 505 | ':qp2' => 2, |
506 | - ':qp3' => 'bar',], |
|
506 | + ':qp3' => 'bar', ], |
|
507 | 507 | ], |
508 | 508 | [ |
509 | 509 | ['not in', ['id', 'name'], [['id' => 1, 'name' => 'foo'], ['id' => 2, 'name' => 'bar']]], |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | [':qp0' => 1, |
512 | 512 | ':qp1' => 'foo', |
513 | 513 | ':qp2' => 2, |
514 | - ':qp3' => 'bar',], |
|
514 | + ':qp3' => 'bar', ], |
|
515 | 515 | ], |
516 | 516 | //[['in', ['id', 'name'], (new Query())->select(['id', 'name'])->from('users')->where(['active' => 1])], 'EXISTS (SELECT 1 FROM (SELECT [[id]], [[name]] FROM [[users]] WHERE [[active]]=:qp0) AS a WHERE a.[[id]] = [[id AND a.]]name[[ = ]]name`)', [':qp0' => 1] ], |
517 | 517 | //[ ['not in', ['id', 'name'], (new Query())->select(['id', 'name'])->from('users')->where(['active' => 1])], 'NOT EXISTS (SELECT 1 FROM (SELECT [[id]], [[name]] FROM [[users]] WHERE [[active]]=:qp0) AS a WHERE a.[[id]] = [[id]] AND a.[[name = ]]name`)', [':qp0' => 1] ], |
@@ -798,31 +798,31 @@ discard block |
||
798 | 798 | return [ |
799 | 799 | 'drop' => [ |
800 | 800 | "DROP INDEX [[$name1]] ON {{{$tableName}}}", |
801 | - static function (QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
801 | + static function(QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
802 | 802 | return $qb->dropIndex($name1, $tableName); |
803 | 803 | }, |
804 | 804 | ], |
805 | 805 | 'create' => [ |
806 | 806 | "CREATE INDEX [[$name1]] ON {{{$tableName}}} ([[C_index_1]])", |
807 | - static function (QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
807 | + static function(QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
808 | 808 | return $qb->createIndex($name1, $tableName, 'C_index_1'); |
809 | 809 | }, |
810 | 810 | ], |
811 | 811 | 'create (2 columns)' => [ |
812 | 812 | "CREATE INDEX [[$name2]] ON {{{$tableName}}} ([[C_index_2_1]], [[C_index_2_2]])", |
813 | - static function (QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
813 | + static function(QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
814 | 814 | return $qb->createIndex($name2, $tableName, 'C_index_2_1, C_index_2_2'); |
815 | 815 | }, |
816 | 816 | ], |
817 | 817 | 'create unique' => [ |
818 | 818 | "CREATE UNIQUE INDEX [[$name1]] ON {{{$tableName}}} ([[C_index_1]])", |
819 | - static function (QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
819 | + static function(QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
820 | 820 | return $qb->createIndex($name1, $tableName, 'C_index_1', QueryBuilder::INDEX_UNIQUE); |
821 | 821 | }, |
822 | 822 | ], |
823 | 823 | 'create unique (2 columns)' => [ |
824 | 824 | "CREATE UNIQUE INDEX [[$name2]] ON {{{$tableName}}} ([[C_index_2_1]], [[C_index_2_2]])", |
825 | - static function (QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
825 | + static function(QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
826 | 826 | return $qb->createIndex($name2, $tableName, 'C_index_2_1, C_index_2_2', QueryBuilder::INDEX_UNIQUE); |
827 | 827 | }, |
828 | 828 | ], |