Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set the column created_at or updated_at to the type timestamps… #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Xethron/MigrationsGenerator/Generators/FieldGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down