pgschema
pgschema copied to clipboard
Incorrect migration for generated columns
old.sql
CREATE TABLE IF NOT EXISTS merge_request (
data jsonb NOT NULL
);
new.sql
CREATE TABLE IF NOT EXISTS merge_request(
data jsonb NOT NULL,
iid integer NOT NULL GENERATED ALWAYS AS ( (data ->> 'iid')::integer ) STORED
);
Expected:
ALTER TABLE merge_request
ADD COLUMN iid integer NOT NULL GENERATED ALWAYS AS ( (data ->> 'iid')::integer ) STORED;
Actual:
ALTER TABLE merge_request ADD COLUMN iid integer NOT NULL;
I guess we haven't implemented GENERATED column, I will take a look
I've tried to implement this myself but found it a bit more complex for me