Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for ULID column type #657

Merged
merged 38 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d896b03
feat: add hasuuids trait to model
rcrosbourne Dec 5, 2023
73c8090
Merge pull request #1 from rcrosbourne/feature/add-hasuuid-trait-to-m…
rcrosbourne Dec 5, 2023
9ad1d23
test: add tests for hasuuids trait
rcrosbourne Dec 6, 2023
70ae6af
Merge pull request #2 from rcrosbourne/feature/add-hasuuid-trait-to-m…
rcrosbourne Dec 6, 2023
8d307d8
refactor(lint): fix code formatting
rcrosbourne Dec 6, 2023
2251bd6
Merge branch 'master' of github.com:rcrosbourne/blueprint
rcrosbourne Dec 6, 2023
2c2e4f5
refactor(lint): fix lint issues in ModelGeneratorTest.php
rcrosbourne Dec 6, 2023
cae0567
Revert
jasonmccreary Dec 6, 2023
1e136c4
Refactor to alphabetical order
jasonmccreary Dec 6, 2023
3eeee20
Streamline boolean logic
jasonmccreary Dec 6, 2023
c71357c
Fix typo
jasonmccreary Dec 6, 2023
ba8aef3
Update regular expression in Blueprint.php
rcrosbourne Dec 7, 2023
5ac1b7e
Add 'ulid' type to ModelLexer.php.
rcrosbourne Dec 7, 2023
fd7e009
Add support for ULID shorthand in migrations
rcrosbourne Dec 7, 2023
6b4d86d
Add ULID support to FactoryGenerator and tests
rcrosbourne Dec 7, 2023
dece6d9
Add ULID support in all-column-types test fixture
rcrosbourne Dec 7, 2023
381bff8
Update FactoryGenerator fixed code format.
rcrosbourne Dec 7, 2023
bf058c9
Add tests and migration for ulid shorthand invalid relationship
rcrosbourne Dec 8, 2023
bb24726
Add test for ULID without relationship scenario
rcrosbourne Dec 8, 2023
0ff644a
Add ULID Morphs to test fixtures
rcrosbourne Dec 8, 2023
14887d7
Update Foreign Key Constraints and Migration Generator
rcrosbourne Dec 8, 2023
5e827d3
Add ULID shorthand test to BlueprintTest
rcrosbourne Dec 8, 2023
690bcf7
Add support for `nullableUlidMorphs` and `ulidMorphs` column types
rcrosbourne Dec 9, 2023
d63b441
Added ULID support in Model and ModelGenerator classes
rcrosbourne Dec 9, 2023
d892679
Added ULID support in Model and ModelGenerator classes
rcrosbourne Dec 9, 2023
1170a34
Removed debug line and linted the code
rcrosbourne Dec 9, 2023
2226e6a
Merge pull request #3 from rcrosbourne/feature/add-ulid-column-type
rcrosbourne Dec 9, 2023
f8c8c91
Merge branch 'feature/add-ulid-column-type' of github.com:rcrosbourne…
rcrosbourne Dec 9, 2023
0f57f5b
remove dump and linted code
rcrosbourne Dec 9, 2023
ec435d5
Merge pull request #4 from rcrosbourne/feature/add-ulid-column-type
rcrosbourne Dec 9, 2023
47d05c6
Added support for ULID and UUID in pivot tables migration
rcrosbourne Dec 9, 2023
461f4e1
Refactor foreign key generation in migrations
rcrosbourne Dec 9, 2023
2c71e68
Merge pull request #5 from rcrosbourne/feature/add-ulid-column-type
rcrosbourne Dec 9, 2023
f6ff73e
Merge branch 'master' into master
rcrosbourne Dec 10, 2023
6036e37
refactor(MigrationGenerator): change method isIdUlidOrUuid to the mor…
rcrosbourne Dec 10, 2023
a2f9119
refactor(lint): fix code format.
rcrosbourne Dec 10, 2023
3e8a73b
refactor(fixtures): update the verbose `id: ulid primary` from fixtu…
rcrosbourne Dec 10, 2023
e9b35ca
refactor(lint): undo the removal of the nullable type declaration for…
rcrosbourne Dec 10, 2023
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
4 changes: 2 additions & 2 deletions src/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function parse($content, $strip_dashes = true)
);

$content = preg_replace_callback(
'/^(\s+)uuid(: true)?$/mi',
fn ($matches) => $matches[1] . 'id: uuid primary',
'/^(\s+)(ulid|uuid)(: true)?$/mi',
fn ($matches) => $matches[1] . 'id: ' . $matches[2] . ' primary',
$content
);

Expand Down
6 changes: 5 additions & 1 deletion src/Generators/FactoryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function buildDefinition(Model $model): string
$definition .= sprintf('%s::factory()->create()->%s', $class, $key);
$definition .= ',' . PHP_EOL;
}
} elseif ($column->dataType() === 'id' || ($column->dataType() === 'uuid' && Str::endsWith($column->name(), '_id'))) {
} elseif ($column->dataType() === 'id' || (in_array($column->dataType(), ['uuid', 'ulid']) && Str::endsWith($column->name(), '_id'))) {
$name = Str::beforeLast($column->name(), '_id');
$class = Str::studly($column->attributes()[0] ?? $name);
$reference = $this->fullyQualifyModelReference($class) ?? $model;
Expand Down Expand Up @@ -156,6 +156,10 @@ protected function buildDefinition(Model $model): string
$definition .= str_repeat(self::INDENT, 3) . "'{$column->name()}' => ";
$definition .= 'Str::random(10)';
$definition .= ',' . PHP_EOL;
} elseif ($column->dataType() === 'ulid') {
$definition .= str_repeat(self::INDENT, 3) . "'{$column->name()}' => ";
$definition .= '(string) Str::ulid()';
$definition .= ',' . PHP_EOL;
} else {
$definition .= str_repeat(self::INDENT, 3) . "'{$column->name()}' => ";

Expand Down
74 changes: 54 additions & 20 deletions src/Generators/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function output(Tree $tree, $overwrite = false): array
if (!empty($model->pivotTables())) {
foreach ($model->pivotTables() as $pivotSegments) {
$pivotTableName = $this->getPivotTableName($pivotSegments);
$tables['pivotTableNames'][$pivotTableName] = $this->populatePivotStub($stub, $pivotSegments);
$tables['pivotTableNames'][$pivotTableName] = $this->populatePivotStub($stub, $pivotSegments, $tree->models());
}
}

Expand Down Expand Up @@ -128,10 +128,10 @@ protected function populateStub(string $stub, Model $model): string
return $stub;
}

protected function populatePivotStub(string $stub, array $segments): string
protected function populatePivotStub(string $stub, array $segments, array $models = []): string
jasonmccreary marked this conversation as resolved.
Show resolved Hide resolved
{
$stub = str_replace('{{ table }}', $this->getPivotTableName($segments), $stub);
$stub = str_replace('{{ definition }}', $this->buildPivotTableDefinition($segments), $stub);
$stub = str_replace('{{ definition }}', $this->buildPivotTableDefinition($segments, $models), $stub);

if ($this->hasForeignKeyConstraints) {
$stub = $this->disableForeignKeyConstraints($stub);
Expand Down Expand Up @@ -194,7 +194,7 @@ protected function buildDefinition(Model $model): string
);
}

if (!empty($columnAttributes) && !$this->isIdOrUuid($column->dataType())) {
if (!empty($columnAttributes) && !$this->isIdColumnType($column->dataType())) {
$column_definition .= ', ';

if (in_array($column->dataType(), ['set', 'enum'])) {
Expand All @@ -221,7 +221,7 @@ protected function buildDefinition(Model $model): string
$column->modifiers()
);

if ($this->isIdOrUuid($column->dataType())) {
if ($this->isIdColumnType($column->dataType())) {
$column_definition = $foreign;
$foreign = '';
}
Expand All @@ -232,7 +232,7 @@ protected function buildDefinition(Model $model): string
|| (is_array($modifier) && key($modifier) === 'onDelete')
|| (is_array($modifier) && key($modifier) === 'onUpdate')
|| $modifier === 'foreign'
|| ($modifier === 'nullable' && $this->isIdOrUuid($column->dataType()))
|| ($modifier === 'nullable' && $this->isIdColumnType($column->dataType()))
);
}

Expand Down Expand Up @@ -290,10 +290,9 @@ protected function buildDefinition(Model $model): string
return trim($definition);
}

protected function buildPivotTableDefinition(array $segments): string
protected function buildPivotTableDefinition(array $segments, array $models = []): string
{
$definition = '';

foreach ($segments as $segment) {
$column = Str::before(Str::snake($segment), ':');
$references = 'id';
Expand All @@ -304,13 +303,49 @@ protected function buildPivotTableDefinition(array $segments): string
$this->hasForeignKeyConstraints = true;
$definition .= $this->buildForeignKey($foreign, $on, 'id') . ';' . PHP_EOL;
} else {
$definition .= self::INDENT . '$table->foreignId(\'' . $foreign . '\');' . PHP_EOL;
$definition .= $this->generateForeignKeyDefinition($segment, $foreign, $models);
}
}

return trim($definition);
}

/**
* Generates the foreign key definition for a pivot table.
*
* This function generates the foreign key definition for a pivot table in a migration file.
* It checks if the model exists and its name matches the pivot table segment. If it does,
* it determines the data type of the primary key and appends the appropriate method call
* to the `$definition` string. If the model does not exist or its name does not match the
* pivot table segment, it defaults to appending `$table->foreignId(\'' . $foreignKeyColumnName . '\');`
* to the `$definition` string. The function then returns the `$definition` string.
*
* @param string $pivotTableSegment The segment of the pivot table. e.g 'dive_job' it would be 'Dive' or 'Job'.
* @param string $foreignKeyColumnName The name of the foreign key column. e.g 'dive_id' or 'job_id'.
* @param array $models An array of models. e.g ['Dive' => $diveModel, 'Job' => $jobModel].
* @return string The foreign key definition. e.g '$table->foreignUlid('dive_id');'
*/
protected function generateForeignKeyDefinition(string $pivotTableSegment, string $foreignKeyColumnName, array $models = []): string
jasonmccreary marked this conversation as resolved.
Show resolved Hide resolved
{
$definition = self::INDENT;
if (count($models) > 0 && array_key_exists($pivotTableSegment, $models)) {
$model = $models[$pivotTableSegment];
if ($model->name() === $pivotTableSegment) {
$dataType = $model->columns()[$model->primaryKey()]->dataType();
$definition .= match ($dataType) {
'ulid' => '$table->foreignUlid(\'' . $foreignKeyColumnName . '\');',
'uuid' => '$table->foreignUuid(\'' . $foreignKeyColumnName . '\');',
default => '$table->foreignId(\'' . $foreignKeyColumnName . '\');',
};
}
} else {
$definition .= '$table->foreignId(\'' . $foreignKeyColumnName . '\');';
}
$definition .= PHP_EOL;

return $definition;
}

protected function buildPolyTableDefinition(string $parentTable): string
{
$definition = '';
Expand Down Expand Up @@ -347,7 +382,7 @@ protected function buildForeignKey(string $column_name, ?string $on, string $typ
$column = Str::afterLast($column_name, '_');
}

if ($this->isIdOrUuid($type) && !empty($attributes)) {
if ($this->isIdColumnType($type) && !empty($attributes)) {
$table = Str::lower(Str::plural($attributes[0]));
}

Expand All @@ -364,12 +399,12 @@ protected function buildForeignKey(string $column_name, ?string $on, string $typ
$on_update_suffix = self::ON_UPDATE_CLAUSES[$on_update_clause];
}

if ($this->isIdOrUuid($type)) {
if ($type === 'uuid') {
$method = 'foreignUuid';
} else {
$method = 'foreignId';
}
if ($this->isIdColumnType($type)) {
$method = match ($type) {
'ulid' => 'foreignUlid',
'uuid' => 'foreignUuid',
default => 'foreignId',
};

$prefix = in_array('nullable', $modifiers)
? '$table->' . "{$method}('{$column_name}')->nullable()"
Expand All @@ -381,7 +416,6 @@ protected function buildForeignKey(string $column_name, ?string $on, string $typ
if ($on_update_clause === 'cascade') {
$on_update_suffix = '->cascadeOnUpdate()';
}

if ($column_name === Str::singular($table) . '_' . $column) {
return self::INDENT . "{$prefix}->constrained(){$on_delete_suffix}{$on_update_suffix}";
}
Expand Down Expand Up @@ -469,7 +503,7 @@ private function shouldAddForeignKeyConstraint(\Blueprint\Models\Column $column)
}

return config('blueprint.use_constraints')
&& ($this->isIdOrUuid($column->dataType()) && Str::endsWith($column->name(), '_id'));
&& ($this->isIdColumnType($column->dataType()) && Str::endsWith($column->name(), '_id'));
}

protected function isNumericDefault(string $type, string $value): bool
Expand All @@ -486,8 +520,8 @@ protected function isNumericDefault(string $type, string $value): bool
->contains(fn ($value) => strtolower($value) === strtolower($type));
}

protected function isIdOrUuid(string $dataType): bool
protected function isIdColumnType(string $dataType): bool
{
return in_array($dataType, ['id', 'uuid']);
return in_array($dataType, ['id', 'ulid', 'uuid']);
}
}
15 changes: 15 additions & 0 deletions src/Generators/ModelGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ protected function buildClassPhpDoc(Model $model): string
$phpDoc .= PHP_EOL;
$phpDoc .= ' * @property string|null $' . $column->name() . '_type';
$phpDoc .= PHP_EOL;
} elseif ($column->dataType() === 'ulidMorphs') {
$phpDoc .= ' * @property string $' . $column->name() . '_id';
$phpDoc .= PHP_EOL;
$phpDoc .= ' * @property string $' . $column->name() . '_type';
$phpDoc .= PHP_EOL;
} elseif ($column->dataType() === 'nullableUlidMorphs') {
$phpDoc .= ' * @property string|null $' . $column->name() . '_id';
$phpDoc .= PHP_EOL;
$phpDoc .= ' * @property string|null $' . $column->name() . '_type';
$phpDoc .= PHP_EOL;
} elseif ($column->dataType() === 'uuidMorphs') {
$phpDoc .= ' * @property string $' . $column->name() . '_id';
$phpDoc .= PHP_EOL;
Expand Down Expand Up @@ -278,6 +288,11 @@ protected function addTraits(Model $model, $stub): string
$traits[] = 'SoftDeletes';
}

if ($model->usesUlids()) {
$this->addImport($model, 'Illuminate\\Database\\Eloquent\\Concerns\\HasUlids');
$traits[] = 'HasUlids';
}

if ($model->usesUuids()) {
$this->addImport($model, 'Illuminate\\Database\\Eloquent\\Concerns\\HasUuids');
$traits[] = 'HasUuids';
Expand Down
1 change: 1 addition & 0 deletions src/Lexers/ModelLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ModelLexer implements Lexer
'unsignedmediuminteger' => 'unsignedMediumInteger',
'unsignedsmallinteger' => 'unsignedSmallInteger',
'unsignedtinyinteger' => 'unsignedTinyInteger',
'ulid' => 'ulid',
'uuid' => 'uuid',
'year' => 'year',
];
Expand Down
5 changes: 5 additions & 0 deletions src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public function usesPrimaryKey(): bool
return $this->primaryKey !== false;
}

public function usesUlids(): bool
{
return $this->usesPrimaryKey() && $this->columns[$this->primaryKey]->dataType() === 'ulid';
}

public function usesUuids(): bool
{
return $this->usesPrimaryKey() && $this->columns[$this->primaryKey]->dataType() === 'uuid';
Expand Down
16 changes: 16 additions & 0 deletions tests/Feature/BlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ public function it_parses_shorthands(): void
], $this->subject->parse($blueprint));
}

#[Test]
public function it_parses_ulid_shorthand(): void
{
$blueprint = $this->fixture('drafts/ulid-shorthand.yaml');

$this->assertEquals([
'models' => [
'Person' => [
'id' => 'ulid primary',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be required to say ulid primary, just ulid is fine as it is the conventional id field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't required to specify ulid primary. Here is the draft file that was used in that test tests/fixtures/drafts/ulid-shorthand.yaml

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is not needed, please remove ulid primary from all of your new fixtures to avoid confusion for those reviewing them as examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the linter is failing in the pipeline. It passes lint checks when I run it locally.

Screenshot 2023-12-10 at 15 58 12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

'timestamps' => 'timestamps',
'company_id' => 'ulid',
],
],
], $this->subject->parse($blueprint));
}

#[Test]
public function it_parses_uuid_shorthand(): void
{
Expand Down
32 changes: 32 additions & 0 deletions tests/Feature/Generators/MigrationGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,35 @@ public function output_creates_constraints_for_unconventional_foreign_reference_
$this->assertEquals(['created' => [$model_migration]], $this->subject->output($tree));
}

#[Test]
public function using_ulids_output_also_creates_pivot_table_migration(): void
{
$this->filesystem->expects('stub')
->with('migration.stub')
->andReturn($this->stub('migration.stub'));

$now = Carbon::now();
Carbon::setTestNow($now);

$journey_model_migration = str_replace('timestamp', $now->copy()->subSeconds(2)->format('Y_m_d_His'), 'database/migrations/timestamp_create_journeys_table.php');
$diary_model_migration = str_replace('timestamp', $now->copy()->subSecond()->format('Y_m_d_His'), 'database/migrations/timestamp_create_diaries_table.php');
$pivot_migration = str_replace('timestamp', $now->format('Y_m_d_His'), 'database/migrations/timestamp_create_diary_journey_table.php');

$this->filesystem->expects('exists')->times(3)->andReturn(false);

$this->filesystem->expects('put')
->with($journey_model_migration, $this->fixture('migrations/belongs-to-many-using-ulids-journey-model.php'));
$this->filesystem->expects('put')
->with($diary_model_migration, $this->fixture('migrations/belongs-to-many-using-ulids-diary-model.php'));
$this->filesystem->expects('put')
->with($pivot_migration, $this->fixture('migrations/belongs-to-many-pivot-using-ulids.php'));

$tokens = $this->blueprint->parse($this->fixture('drafts/belongs-to-many-using-ulids.yaml'));
$tree = $this->blueprint->analyze($tokens);

$this->assertEquals(['created' => [$journey_model_migration, $diary_model_migration, $pivot_migration]], $this->subject->output($tree));
}

#[Test]
public function output_also_creates_pivot_table_migration(): void
{
Expand Down Expand Up @@ -527,6 +556,9 @@ public static function modelTreeDataProvider()
['drafts/optimize.yaml', 'database/migrations/timestamp_create_optimizes_table.php', 'migrations/optimize.php'],
['drafts/model-key-constraints.yaml', 'database/migrations/timestamp_create_orders_table.php', 'migrations/model-key-constraints.php'],
['drafts/disable-auto-columns.yaml', 'database/migrations/timestamp_create_states_table.php', 'migrations/disable-auto-columns.php'],
['drafts/ulid-shorthand.yaml', 'database/migrations/timestamp_create_people_table.php', 'migrations/ulid-shorthand.php'],
['drafts/ulid-shorthand-invalid-relationship.yaml', 'database/migrations/timestamp_create_age_cohorts_table.php', 'migrations/ulid-shorthand-invalid-relationship.php'],
['drafts/ulid-without-relationship.yaml', 'database/migrations/timestamp_create_vats_table.php', 'migrations/ulid-without-relationship.php'],
['drafts/uuid-shorthand.yaml', 'database/migrations/timestamp_create_people_table.php', 'migrations/uuid-shorthand.php'],
['drafts/uuid-shorthand-invalid-relationship.yaml', 'database/migrations/timestamp_create_age_cohorts_table.php', 'migrations/uuid-shorthand-invalid-relationship.php'],
['drafts/uuid-without-relationship.yaml', 'database/migrations/timestamp_create_vats_table.php', 'migrations/uuid-without-relationship.php'],
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/Generators/ModelGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ public static function modelTreeDataProvider(): array
['drafts/uuid-shorthand-invalid-relationship.yaml', 'app/Models/AgeCohort.php', 'models/uuid-shorthand-invalid-relationship.php'],
['drafts/model-with-meta.yaml', 'app/Models/Post.php', 'models/model-with-meta.php'],
['drafts/infer-belongsto.yaml', 'app/Models/Conference.php', 'models/infer-belongsto.php'],
['drafts/model-with-ulid-id.yaml', 'app/Models/User.php', 'models/model-with-ulid-trait.php'],
['drafts/model-with-uuid-id.yaml', 'app/Models/User.php', 'models/model-with-uuid-trait.php'],
];
}
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/drafts/all-column-types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ models:
mediumInteger: mediumInteger
mediumText: mediumText
morphs: morphs
ulidMorphs: ulidMorphs
uuidMorphs: uuidMorphs
multiLineString: multiLineString
multiPoint: multiPoint
multiPolygon: multiPolygon
nullableMorphs: nullableMorphs
nullableUlidMorphs: nullableUuidMorphs
nullableUuidMorphs: nullableUuidMorphs
nullableTimestamps: nullableTimestamps
point: point
Expand All @@ -50,5 +52,6 @@ models:
unsignedMediumInteger: unsignedMediumInteger
unsignedSmallInteger: unsignedSmallInteger
unsignedTinyInteger: unsignedTinyInteger
ulid: ulid
uuid: uuid
year: year
11 changes: 11 additions & 0 deletions tests/fixtures/drafts/belongs-to-many-using-ulids.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
models:
Journey:
ulid
name: string
user_id: ulid foreign
relationships:
belongsToMany: Diary
Diary:
ulid
relationships:
belongsToMany: Journey
2 changes: 2 additions & 0 deletions tests/fixtures/drafts/model-key-constraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ models:
sub_id: uuid foreign:subscription
expires_at: timestamp nullable index
meta: json default:'[]'
customer_id: ulid foreign
tran_id: ulid foreign:transaction
5 changes: 5 additions & 0 deletions tests/fixtures/drafts/model-with-ulid-id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
models:
User:
ulid
name: string
base_pay: decimal:10,2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
models:
AgeCohort:
id
timestamps
name: string:100
description: string:500 nullable
min_age: integer nullable
max_age: integer nullable
ulid: ulid unique
5 changes: 5 additions & 0 deletions tests/fixtures/drafts/ulid-shorthand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
models:
Person:
ulid
company_id: ulid
timestamps
3 changes: 3 additions & 0 deletions tests/fixtures/drafts/ulid-without-relationship.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
models:
Vat:
ulid: ulid
Loading
Loading