Skip to content

Commit

Permalink
style: minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodmain committed May 19, 2024
1 parent 26c2776 commit 097efb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Traits/FixturesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ public function prepareSequences(array $except = []): void
return '';
} else {
$sequenceName = str_replace(["nextval('", "'::regclass)"], '', $item->column_default);
$tableName = "{$item->table_schema}.{$item->table_name}";

return "SELECT setval('{$sequenceName}', (select coalesce(max({$item->column_name}), 1) from " .
"{$item->table_schema}.{$item->table_name}), (case when (select max({$item->column_name}) from {$item->table_schema}.{$item->table_name}) " .
"{$tableName}), (case when (select max({$item->column_name}) from {$tableName}) " .
"is NULL then false else true end));\n";

}
});

Expand Down

0 comments on commit 097efb0

Please sign in to comment.