From 55e4cb35156d4990861eea2038ef84b73779bfe3 Mon Sep 17 00:00:00 2001 From: Brent Roose Date: Fri, 16 Aug 2024 10:04:31 +0200 Subject: [PATCH] Update test migration --- tests/Fixtures/Migrations/CreateBookTable.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/Fixtures/Migrations/CreateBookTable.php b/tests/Fixtures/Migrations/CreateBookTable.php index 0102fa7b2..158051132 100644 --- a/tests/Fixtures/Migrations/CreateBookTable.php +++ b/tests/Fixtures/Migrations/CreateBookTable.php @@ -5,12 +5,8 @@ namespace Tests\Tempest\Fixtures\Migrations; use Tempest\Database\Migration; -use Tempest\Database\QueryStatements\BelongsToStatement; use Tempest\Database\QueryStatements\CreateTableStatement; use Tempest\Database\QueryStatements\DropTableStatement; -use Tempest\Database\QueryStatements\PrimaryKeyStatement; -use Tempest\Database\QueryStatements\RawStatement; -use Tempest\Database\QueryStatements\TextStatement; final readonly class CreateBookTable implements Migration { @@ -21,15 +17,11 @@ public function getName(): string public function up(): CreateTableStatement|null { - return new CreateTableStatement( - 'Book', - [ - new PrimaryKeyStatement(), - new TextStatement('title'), - new RawStatement('author_id INTEGER'), - new BelongsToStatement('Book.author_id', 'Author.id'), - ] - ); + return (new CreateTableStatement('Book')) + ->primary() + ->text('title') + ->integer('author_id', nullable: true) + ->belongsTo('Book.author_id', 'Author.id'); } public function down(): DropTableStatement|null