We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
nullable: true
I'm trying to add a SERIAL field as incremental_id. When creating a table, if I set nullable: true, it seems that this annotation is ignored.
incremental_id
Example:
#[Entity(repository: CheckoutRepository::class)] class Checkout { #[Column(type: 'serial', nullable: true, unique: true)] public ?int $incrementalId = null; #[Column(type: 'uuid', primary: true, typecast: [CheckoutId::class, 'castValue'], unique: true)] private CheckoutId $id; // ...
When migrations are generated, in code I see:
$this->table('checkouts') ->addColumn('id', 'uuid', ['nullable' => false, 'defaultValue' => null, 'unique' => true]) ->addColumn('incremental_id', 'serial', ['nullable' => false, 'defaultValue' => null])
PHP 8.2 cycle/migrations v4.2.3 cycle/annotated: v3.4.0 cycle/database: v2.7.1 cycle/orm v2.6.1
Initial PR, that added support for SERIAL:
https://github.com/cycle/database/pull/106/files
The text was updated successfully, but these errors were encountered:
There is also no possibility to use Serial in default way.
#[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, [email protected], 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).
Sorry, something went wrong.
msmakouz
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: