@@ -130,7 +130,7 @@ protected function _convertColumn($column)
130
130
}
131
131
if (strpos ($ col , 'text ' ) !== false ) {
132
132
$ lengthName = substr ($ col , 0 , -4 );
133
- $ length = isset (Table ::$ columnLengths [$ lengthName ]) ? Table ::$ columnLengths [$ lengthName ] : null ;
133
+ $ length = isset (TableSchema ::$ columnLengths [$ lengthName ]) ? TableSchema ::$ columnLengths [$ lengthName ] : null ;
134
134
135
135
return ['type ' => TableSchema::TYPE_TEXT , 'length ' => $ length ];
136
136
}
@@ -139,7 +139,7 @@ protected function _convertColumn($column)
139
139
}
140
140
if (strpos ($ col , 'blob ' ) !== false || $ col === 'binary ' ) {
141
141
$ lengthName = substr ($ col , 0 , -4 );
142
- $ length = isset (Table ::$ columnLengths [$ lengthName ]) ? Table ::$ columnLengths [$ lengthName ] : null ;
142
+ $ length = isset (TableSchema ::$ columnLengths [$ lengthName ]) ? TableSchema ::$ columnLengths [$ lengthName ] : null ;
143
143
144
144
return ['type ' => TableSchema::TYPE_BINARY , 'length ' => $ length ];
145
145
}
@@ -195,25 +195,25 @@ public function convertIndexDescription(TableSchema $schema, $row)
195
195
196
196
$ name = $ row ['Key_name ' ];
197
197
if ($ name === 'PRIMARY ' ) {
198
- $ name = $ type = Table ::CONSTRAINT_PRIMARY ;
198
+ $ name = $ type = TableSchema ::CONSTRAINT_PRIMARY ;
199
199
}
200
200
201
201
$ columns [] = $ row ['Column_name ' ];
202
202
203
203
if ($ row ['Index_type ' ] === 'FULLTEXT ' ) {
204
- $ type = Table ::INDEX_FULLTEXT ;
204
+ $ type = TableSchema ::INDEX_FULLTEXT ;
205
205
} elseif ($ row ['Non_unique ' ] == 0 && $ type !== 'primary ' ) {
206
- $ type = Table ::CONSTRAINT_UNIQUE ;
206
+ $ type = TableSchema ::CONSTRAINT_UNIQUE ;
207
207
} elseif ($ type !== 'primary ' ) {
208
- $ type = Table ::INDEX_INDEX ;
208
+ $ type = TableSchema ::INDEX_INDEX ;
209
209
}
210
210
211
211
if (!empty ($ row ['Sub_part ' ])) {
212
212
$ length [$ row ['Column_name ' ]] = $ row ['Sub_part ' ];
213
213
}
214
214
$ isIndex = (
215
- $ type === Table ::INDEX_INDEX ||
216
- $ type === Table ::INDEX_FULLTEXT
215
+ $ type === TableSchema ::INDEX_INDEX ||
216
+ $ type === TableSchema ::INDEX_FULLTEXT
217
217
);
218
218
if ($ isIndex ) {
219
219
$ existing = $ schema ->getIndex ($ name );
@@ -263,7 +263,7 @@ public function describeForeignKeySql($tableName, $config)
263
263
public function convertForeignKeyDescription (TableSchema $ schema , $ row )
264
264
{
265
265
$ data = [
266
- 'type ' => Table ::CONSTRAINT_FOREIGN ,
266
+ 'type ' => TableSchema ::CONSTRAINT_FOREIGN ,
267
267
'columns ' => [$ row ['COLUMN_NAME ' ]],
268
268
'references ' => [$ row ['REFERENCED_TABLE_NAME ' ], $ row ['REFERENCED_COLUMN_NAME ' ]],
269
269
'update ' => $ this ->_convertOnClause ($ row ['UPDATE_RULE ' ]),
@@ -345,27 +345,27 @@ public function columnSql(TableSchema $schema, $name)
345
345
}
346
346
break ;
347
347
case TableSchema::TYPE_TEXT :
348
- $ isKnownLength = in_array ($ data ['length ' ], Table ::$ columnLengths );
348
+ $ isKnownLength = in_array ($ data ['length ' ], TableSchema ::$ columnLengths );
349
349
if (empty ($ data ['length ' ]) || !$ isKnownLength ) {
350
350
$ out .= ' TEXT ' ;
351
351
break ;
352
352
}
353
353
354
354
if ($ isKnownLength ) {
355
- $ length = array_search ($ data ['length ' ], Table ::$ columnLengths );
355
+ $ length = array_search ($ data ['length ' ], TableSchema ::$ columnLengths );
356
356
$ out .= ' ' . strtoupper ($ length ) . 'TEXT ' ;
357
357
}
358
358
359
359
break ;
360
360
case TableSchema::TYPE_BINARY :
361
- $ isKnownLength = in_array ($ data ['length ' ], Table ::$ columnLengths );
361
+ $ isKnownLength = in_array ($ data ['length ' ], TableSchema ::$ columnLengths );
362
362
if (empty ($ data ['length ' ]) || !$ isKnownLength ) {
363
363
$ out .= ' BLOB ' ;
364
364
break ;
365
365
}
366
366
367
367
if ($ isKnownLength ) {
368
- $ length = array_search ($ data ['length ' ], Table ::$ columnLengths );
368
+ $ length = array_search ($ data ['length ' ], TableSchema ::$ columnLengths );
369
369
$ out .= ' ' . strtoupper ($ length ) . 'BLOB ' ;
370
370
}
371
371
@@ -452,7 +452,7 @@ public function columnSql(TableSchema $schema, $name)
452
452
public function constraintSql (TableSchema $ schema , $ name )
453
453
{
454
454
$ data = $ schema ->getConstraint ($ name );
455
- if ($ data ['type ' ] === Table ::CONSTRAINT_PRIMARY ) {
455
+ if ($ data ['type ' ] === TableSchema ::CONSTRAINT_PRIMARY ) {
456
456
$ columns = array_map (
457
457
[$ this ->_driver , 'quoteIdentifier ' ],
458
458
$ data ['columns ' ]
@@ -462,10 +462,10 @@ public function constraintSql(TableSchema $schema, $name)
462
462
}
463
463
464
464
$ out = '' ;
465
- if ($ data ['type ' ] === Table ::CONSTRAINT_UNIQUE ) {
465
+ if ($ data ['type ' ] === TableSchema ::CONSTRAINT_UNIQUE ) {
466
466
$ out = 'UNIQUE KEY ' ;
467
467
}
468
- if ($ data ['type ' ] === Table ::CONSTRAINT_FOREIGN ) {
468
+ if ($ data ['type ' ] === TableSchema ::CONSTRAINT_FOREIGN ) {
469
469
$ out = 'CONSTRAINT ' ;
470
470
}
471
471
$ out .= $ this ->_driver ->quoteIdentifier ($ name );
@@ -483,7 +483,7 @@ public function addConstraintSql(TableSchema $schema)
483
483
484
484
foreach ($ schema ->constraints () as $ name ) {
485
485
$ constraint = $ schema ->getConstraint ($ name );
486
- if ($ constraint ['type ' ] === Table ::CONSTRAINT_FOREIGN ) {
486
+ if ($ constraint ['type ' ] === TableSchema ::CONSTRAINT_FOREIGN ) {
487
487
$ tableName = $ this ->_driver ->quoteIdentifier ($ schema ->name ());
488
488
$ sql [] = sprintf ($ sqlPattern , $ tableName , $ this ->constraintSql ($ schema , $ name ));
489
489
}
@@ -502,7 +502,7 @@ public function dropConstraintSql(TableSchema $schema)
502
502
503
503
foreach ($ schema ->constraints () as $ name ) {
504
504
$ constraint = $ schema ->getConstraint ($ name );
505
- if ($ constraint ['type ' ] === Table ::CONSTRAINT_FOREIGN ) {
505
+ if ($ constraint ['type ' ] === TableSchema ::CONSTRAINT_FOREIGN ) {
506
506
$ tableName = $ this ->_driver ->quoteIdentifier ($ schema ->name ());
507
507
$ constraintName = $ this ->_driver ->quoteIdentifier ($ name );
508
508
$ sql [] = sprintf ($ sqlPattern , $ tableName , $ constraintName );
@@ -519,10 +519,10 @@ public function indexSql(TableSchema $schema, $name)
519
519
{
520
520
$ data = $ schema ->getIndex ($ name );
521
521
$ out = '' ;
522
- if ($ data ['type ' ] === Table ::INDEX_INDEX ) {
522
+ if ($ data ['type ' ] === TableSchema ::INDEX_INDEX ) {
523
523
$ out = 'KEY ' ;
524
524
}
525
- if ($ data ['type ' ] === Table ::INDEX_FULLTEXT ) {
525
+ if ($ data ['type ' ] === TableSchema ::INDEX_FULLTEXT ) {
526
526
$ out = 'FULLTEXT KEY ' ;
527
527
}
528
528
$ out .= $ this ->_driver ->quoteIdentifier ($ name );
@@ -548,7 +548,7 @@ protected function _keySql($prefix, $data)
548
548
$ columns [$ i ] .= sprintf ('(%d) ' , $ data ['length ' ][$ column ]);
549
549
}
550
550
}
551
- if ($ data ['type ' ] === Table ::CONSTRAINT_FOREIGN ) {
551
+ if ($ data ['type ' ] === TableSchema ::CONSTRAINT_FOREIGN ) {
552
552
return $ prefix . sprintf (
553
553
' FOREIGN KEY (%s) REFERENCES %s (%s) ON UPDATE %s ON DELETE %s ' ,
554
554
implode (', ' , $ columns ),
0 commit comments