Skip to content

Commit

Permalink
Add timestamps if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Feb 14, 2020
1 parent 74b12df commit c73e66d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Sushi.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public function migrate()
$table->increments($this->primaryKey);
}

if ($this->timestamps && ! in_array('update_at', array_keys($firstRow)) || ! in_array('created_at', array_keys($firstRow))) {
$table->timestamps();
}

foreach ($firstRow as $column => $value) {
$type = is_numeric($value) ? 'integer' : 'string';

Expand Down

0 comments on commit c73e66d

Please sign in to comment.