You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a column which is a database generated UUID default value, however, I can't seem to get this working.
What I expect to happen is that when I create a record without specifying a value for the column in question. After the record is saved the the column in question will have a UUID value.
-- +micrate Up
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATETABLEaccounts (
id BIGSERIALPRIMARY KEY,
name VARCHAR,
api_key uuid NOT NULL DEFAULT uuid_generate_v4(),
created_at TIMESTAMP,
updated_at TIMESTAMP
);
-- +micrate DownDROPTABLE IF EXISTS accounts;
I'm trying to create a column which is a database generated UUID default value, however, I can't seem to get this working.
What I expect to happen is that when I create a record without specifying a value for the column in question. After the record is saved the the column in question will have a UUID value.
This results in
null value in column "api_key" violates not-null constraint
.How do I get Granite to support default db values?
The text was updated successfully, but these errors were encountered: