Skip to content

Commit

Permalink
set primary key when keyType is string (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
cappuc committed Jan 21, 2024
1 parent 77a6174 commit 7e68c48
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 @@ -159,6 +159,10 @@ public function createTable(string $tableName, $firstRow)
$type = $schema[$column] ?? $type;

$table->{$type}($column)->nullable();

if ($column === $this->primaryKey) {
$table->primary($this->primaryKey);
}
}

if ($this->usesTimestamps() && (! in_array('updated_at', array_keys($firstRow)) || ! in_array('created_at', array_keys($firstRow)))) {
Expand Down

0 comments on commit 7e68c48

Please sign in to comment.