@@ -130,18 +130,18 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $tableIndexes = $this->getTableIndexes($value['table_name']); |
| 132 | 132 | if (!is_null($tableIndexes) && count($tableIndexes)){ |
| 133 | - foreach ($tableIndexes as $index) { |
|
| 133 | + foreach ($tableIndexes as $index) { |
|
| 134 | 134 | if(Str::endsWith($index['Key_name'], '_index')) { |
| 135 | - $up .= ' $' . "table->index('" . $index['Column_name'] . "');\n"; |
|
| 135 | + $up .= ' $' . "table->index('" . $index['Column_name'] . "');\n"; |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | $up .= " });\n\n"; |
| 141 | 141 | $Constraint = $ConstraintDown = ""; |
| 142 | 142 | /** |
| 143 | - * @var array $tableConstraints |
|
| 144 | - */ |
|
| 143 | + * @var array $tableConstraints |
|
| 144 | + */ |
|
| 145 | 145 | $tableConstraints = $this->getTableConstraints($value['table_name']); |
| 146 | 146 | if (!is_null($tableConstraints) && count($tableConstraints)) { |
| 147 | 147 | $Constraint = $ConstraintDown = " |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | public function columnType($type) |
| 172 | 172 | { |
| 173 | - return array_key_exists($type, $columns) ? $this->columns[$type] : ''; |
|
| 173 | + return array_key_exists($type, $columns) ? $this->columns[$type] : ''; |
|
| 174 | 174 | } |
| 175 | 175 | /** |
| 176 | 176 | * Compile the migration into the base migration file |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | 'longtext' => 'longText', |
| 32 | 32 | 'mediumtext'=> 'mediumText', |
| 33 | 33 | 'text' => 'text', |
| 34 | - 'longblob' => 'binary' , |
|
| 34 | + 'longblob' => 'binary', |
|
| 35 | 35 | 'blob' => 'binary', |
| 36 | 36 | 'enum' => 'enum' |
| 37 | 37 | ]; |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | $numbers = ""; |
| 113 | 113 | $nullable = $values->Null == "NO" ? "" : "->nullable()"; |
| 114 | 114 | $default = empty($values->Default) ? "" : "->default(\"{$values->Default}\")"; |
| 115 | - $default= $values->Default =='CURRENT_TIMESTAMP' ? '->useCurrent()':$default; |
|
| 116 | - $unsigned = strpos($values->Type, "unsigned") === false ? '': '->unsigned()'; |
|
| 115 | + $default = $values->Default == 'CURRENT_TIMESTAMP' ? '->useCurrent()' : $default; |
|
| 116 | + $unsigned = strpos($values->Type, "unsigned") === false ? '' : '->unsigned()'; |
|
| 117 | 117 | |
| 118 | 118 | if (in_array($type, ['var', 'varchar', 'enum', 'decimal', 'float'])) { |
| 119 | 119 | $para = strpos($values->Type, '('); |
| 120 | 120 | $opt = substr($values->Type, $para + 1, -1); |
| 121 | - $numbers = $type== 'enum' ? ', array(' . $opt . ')' : ", " .$opt; |
|
| 121 | + $numbers = $type == 'enum' ? ', array(' . $opt . ')' : ", " . $opt; |
|
| 122 | 122 | } |
| 123 | 123 | $method = $this->columnType($type); |
| 124 | 124 | if ($values->Key == 'PRI') { |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $tableIndexes = $this->getTableIndexes($value['table_name']); |
| 132 | - if (!is_null($tableIndexes) && count($tableIndexes)){ |
|
| 132 | + if (!is_null($tableIndexes) && count($tableIndexes)) { |
|
| 133 | 133 | foreach ($tableIndexes as $index) { |
| 134 | - if(Str::endsWith($index['Key_name'], '_index')) { |
|
| 134 | + if (Str::endsWith($index['Key_name'], '_index')) { |
|
| 135 | 135 | $up .= ' $' . "table->index('" . $index['Column_name'] . "');\n"; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | * Table: {$name} |
| 197 | 197 | */ |
| 198 | 198 | {$values['up']}"; |
| 199 | - $upConstraint.=" |
|
| 199 | + $upConstraint .= " |
|
| 200 | 200 | {$values['constraint']}"; |
| 201 | - $downConstraint.=" |
|
| 201 | + $downConstraint .= " |
|
| 202 | 202 | {$values['constraint_down']}"; |
| 203 | 203 | |
| 204 | 204 | $downSchema .= " |