diff --git a/src/Xethron/MigrationsGenerator/Generators/FieldGenerator.php b/src/Xethron/MigrationsGenerator/Generators/FieldGenerator.php index 0ac0220..7e7c407 100644 --- a/src/Xethron/MigrationsGenerator/Generators/FieldGenerator.php +++ b/src/Xethron/MigrationsGenerator/Generators/FieldGenerator.php @@ -124,10 +124,12 @@ protected function getFields($columns, IndexGenerator $indexGenerator) $nullable = false; $type = 'softDeletes'; $name = ''; - } elseif ($name == 'created_at' and isset($fields['updated_at'])) { + } elseif ($name == 'created_at' and isset($fields['updated_at']) and empty($index) + and !in_array("index", $fields['updated_at']['decorators'])) { $fields['updated_at'] = ['field' => '', 'type' => 'timestamps']; continue; - } elseif ($name == 'updated_at' and isset($fields['created_at'])) { + } elseif ($name == 'updated_at' and isset($fields['created_at']) and empty($index) + and !in_array("index", $fields['created_at']['decorators'])) { $fields['created_at'] = ['field' => '', 'type' => 'timestamps']; continue; }