Skip to content

Commit

Permalink
Update test migration
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Aug 16, 2024
1 parent 6d7af32 commit 55e4cb3
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions tests/Fixtures/Migrations/CreateBookTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
Expand Down

0 comments on commit 55e4cb3

Please sign in to comment.