Open lotyp opened 5 months ago
There is also no possibility to use Serial in default way.
Example:
#[Entity(repository: CheckoutRepository::class)]
#[Uuid7(field: 'id', column: 'id')]
class Checkout implements AggregateRoot, AuditableEntity
{
use AggregatableRoot;
use HasSignatures;
#[Column(type: 'serial', unique: true)]
public ?int $incrementalId = null;
#[Column(type: 'uuid', primary: true, typecast: [CheckoutId::class, 'castValue'], unique: true)]
private CheckoutId $id;
Will give this error:
SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "incremental_id" of relation "checkouts" violates not-null constraint
DETAIL: Failing row contains (018d5fef-2e65-7042-bea7-139479dae10d, null, pending, yortiz@lehner.org, 018d5fef-2cb4-7019-a51a-fef21eca9076, null, {"firstName":"Clara","lastName":"Botsford","middleName":null}, Gleichner-Keebler, +17144848501, {"country":"SA","state":"Texas","city":"Port Jacklyn","postCode"..., {"firstName":"Terrence","lastName":"Larkin","middleName":null}, Mueller, Fritsch and Hyatt, +12183760708, {"country":"GF","state":"Delaware","city":"North Clemmie","postC..., null, null, [], 2024-01-31 14:32:07, {"id":"018d5fef-2e65-7042-bea7-13947ac6ed85","party":"random-par..., 2024-01-31 14:32:07, {"id":"018d5fef-2e65-7042-bea7-13947ac6ed85","party":"random-par..., null, null).
No duplicates 🥲.
What happened?
I'm trying to add a SERIAL field as
incremental_id
. When creating a table, if I setnullable: true
, it seems that this annotation is ignored.Example:
When migrations are generated, in code I see:
Version
Initial PR, that added support for SERIAL:
https://github.com/cycle/database/pull/106/files