Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Lexers/ModelLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class ModelLexer implements Lexer
'nullable' => 'nullable',
'unsigned' => 'unsigned',
'usecurrent' => 'useCurrent',
'usecurrentonupdate' => 'useCurrentOnUpdate',
'always' => 'always',
'unique' => 'unique',
'index' => 'index',
Expand Down
4 changes: 3 additions & 1 deletion tests/Feature/Lexers/ModelLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public function it_accepts_lowercase_keywords()
'sequence' => 'unsignedbiginteger autoincrement',
'content' => 'longtext',
'saved_at' => 'timestamptz usecurrent',
'updated_at' => 'timestamptz usecurrent usecurrentOnUpdate',
],
],
];
Expand All @@ -241,7 +242,7 @@ public function it_accepts_lowercase_keywords()
$this->assertFalse($model->usesSoftDeletes());

$columns = $model->columns();
$this->assertCount(4, $columns);
$this->assertCount(5, $columns);
$this->assertEquals('id', $columns['id']->name());
$this->assertEquals('id', $columns['id']->dataType());
$this->assertEquals([], $columns['id']->attributes());
Expand All @@ -258,6 +259,7 @@ public function it_accepts_lowercase_keywords()
$this->assertEquals('timestampTz', $columns['saved_at']->dataType());
$this->assertEquals([], $columns['saved_at']->attributes());
$this->assertEquals(['useCurrent'], $columns['saved_at']->modifiers());
$this->assertEquals(['useCurrent', 'useCurrentOnUpdate'], $columns['updated_at']->modifiers());
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/fixtures/drafts/post.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ models:
author_id: id
author_bio: longtext
content: bigtext nullable
published_at: timestamp nullable
published_at: timestamp nullable useCurrent
updated_at: timestamp nullable useCurrent useCurrentOnUpdate
word_count: integer unsigned
1 change: 1 addition & 0 deletions tests/fixtures/factories/post-configured-laravel8.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function definition()
'author_bio' => $this->faker->text,
'content' => $this->faker->paragraphs(3, true),
'published_at' => $this->faker->dateTime(),
'updated_at' => $this->faker->dateTime(),
'word_count' => $this->faker->randomNumber(),
];
}
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/factories/post-configured.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'author_bio' => $faker->text,
'content' => $faker->paragraphs(3, true),
'published_at' => $faker->dateTime(),
'updated_at' => $faker->dateTime(),
'word_count' => $faker->randomNumber(),
];
});
1 change: 1 addition & 0 deletions tests/fixtures/factories/post-laravel8.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function definition()
'author_bio' => $this->faker->text,
'content' => $this->faker->paragraphs(3, true),
'published_at' => $this->faker->dateTime(),
'updated_at' => $this->faker->dateTime(),
'word_count' => $this->faker->randomNumber(),
];
}
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/factories/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'author_bio' => $faker->text,
'content' => $faker->paragraphs(3, true),
'published_at' => $faker->dateTime(),
'updated_at' => $faker->dateTime(),
'word_count' => $faker->randomNumber(),
];
});