|
@@ -85,12 +85,12 @@ discard block |
|
|
block discarded – undo |
|
85
|
85
|
$numbers = ""; |
|
86
|
86
|
$nullable = $values->Null == "NO" ? "" : "->nullable()"; |
|
87
|
87
|
$default = empty($values->Default) ? "" : "->default(\"{$values->Default}\")"; |
|
88
|
|
- $unsigned = strpos($values->Type, "unsigned") === false ? '': '->unsigned()'; |
|
|
88
|
+ $unsigned = strpos($values->Type, "unsigned") === false ? '' : '->unsigned()'; |
|
89
|
89
|
|
|
90
|
90
|
if (in_array($type, ['var', 'varchar', 'enum', 'decimal', 'float'])) { |
|
91
|
91
|
$para = strpos($values->Type, '('); |
|
92
|
92
|
$opt = ", " . substr($values->Type, $para + 1, -1); |
|
93
|
|
- $numbers = $type== 'enum' ? ', array(' . $opt . ')' : $opt; |
|
|
93
|
+ $numbers = $type == 'enum' ? ', array(' . $opt . ')' : $opt; |
|
94
|
94
|
} |
|
95
|
95
|
$method = $this->columnType($type); |
|
96
|
96
|
if ($values->Key == 'PRI') { |
|
@@ -101,9 +101,9 @@ discard block |
|
|
block discarded – undo |
|
101
|
101
|
} |
|
102
|
102
|
|
|
103
|
103
|
$tableIndexes = $this->getTableIndexes($value['table_name']); |
|
104
|
|
- if (!is_null($tableIndexes) && count($tableIndexes)){ |
|
|
104
|
+ if (!is_null($tableIndexes) && count($tableIndexes)) { |
|
105
|
105
|
foreach ($tableIndexes as $index) { |
|
106
|
|
- if(Str::endsWith($index['Key_name'], '_index')) { |
|
|
106
|
+ if (Str::endsWith($index['Key_name'], '_index')) { |
|
107
|
107
|
$up .= ' $' . "table->index('" . $index['Key_name'] . "');\n"; |
|
108
|
108
|
} |
|
109
|
109
|
} |
|
@@ -142,7 +142,7 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
|
|
143
|
143
|
public function columnType($type) |
|
144
|
144
|
{ |
|
145
|
|
- $columns = ['int'=> 'integer','smallint' => 'smallInteger','bigint' => 'bigInteger','char '=>'string', 'varchar' => 'string','float' => 'float','double' => 'double','decimal' => 'decimal','tinyint' => 'boolean','date' => 'date','timestamp' => 'timestamp','datetime' => 'dateTime','longtext' => 'longText','mediumtext' => 'mediumText','text' => 'text','longblob' => 'binary' ,'blob' => 'binary','enum' => 'enum']; |
|
|
145
|
+ $columns = ['int'=> 'integer', 'smallint' => 'smallInteger', 'bigint' => 'bigInteger', 'char '=>'string', 'varchar' => 'string', 'float' => 'float', 'double' => 'double', 'decimal' => 'decimal', 'tinyint' => 'boolean', 'date' => 'date', 'timestamp' => 'timestamp', 'datetime' => 'dateTime', 'longtext' => 'longText', 'mediumtext' => 'mediumText', 'text' => 'text', 'longblob' => 'binary', 'blob' => 'binary', 'enum' => 'enum']; |
|
146
|
146
|
return array_key_exists($type, $columns) ? $columns[$type] : ''; |
|
147
|
147
|
|
|
148
|
148
|
|
|
@@ -172,9 +172,9 @@ discard block |
|
|
block discarded – undo |
|
172
|
172
|
* Table: {$name} |
|
173
|
173
|
*/ |
|
174
|
174
|
{$values['up']}"; |
|
175
|
|
- $upConstraint.=" |
|
|
175
|
+ $upConstraint .= " |
|
176
|
176
|
{$values['constraint']}"; |
|
177
|
|
- $downConstraint.=" |
|
|
177
|
+ $downConstraint .= " |
|
178
|
178
|
{$values['constraint_down']}"; |
|
179
|
179
|
|
|
180
|
180
|
$downSchema .= " |