Skip to content

Commit

Permalink
Add a boolean to Attribute in order to define if it is nullable in da…
Browse files Browse the repository at this point in the history
…tabase
  • Loading branch information
bastien-phi committed Dec 19, 2023
1 parent 9628449 commit c8d6e64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Domain/Models/Actions/ResolveModelAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function execute(Model $model): void
$attribute->inDatabase = true;
if (!$column->getNotnull() && !$this->isLaravelTimestamp($model, $attribute)) {
$attribute->nullable = true;
$attribute->nullableInDatabase = true;
}

$model->addAttribute($typeCaster->resolve($attribute));
Expand Down
2 changes: 2 additions & 0 deletions src/Domain/Models/Entities/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Attribute

public bool $inDatabase = false;

public bool $nullableInDatabase = false;

public ?string $comment = null;

public function __construct(string $name, string $type)
Expand Down

0 comments on commit c8d6e64

Please sign in to comment.