It is possible to split the alter column, because currently all definitions of a column are in the same alter.
Here is an exemple
origin-table:
CREATE TABLE "acl"(
"id" CITEXT NOT NULL,
"page_id" CITEXT NOT NULL,
"creation_date" TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
"modification_date" TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
new-table :
CREATE TABLE "acl"(
"id" TEXT NOT NULL,
"page_id" TEXT NOT NULL,
"creation_date" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
"modification_date" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
);
the rollout result :
ALTER TABLE acl
ALTER COLUMN id TYPE TEXT
ALTER COLUMN page_id TYPE TEXT,
ALTER COLUMN creation_date TYPE TIMESTAMP WITH TIME ZONE NOT NULL ,
ALTER COLUMN modification_date TYPE TIMESTAMP WITH TIME ZONE NOT NULL;
This result generate an syntax error.
The right query should be :
ALTER TABLE acl
ALTER COLUMN id TYPE TEXT
ALTER COLUMN page_id TYPE TEXT,
ALTER COLUMN creation_date TYPE TIMESTAMP WITH TIME ZONE
ALTER COLUMN creation_date TYPE NOT NULL ,
ALTER COLUMN modification_date TYPE NOT NULL,
ALTER COLUMN modification_date TYPE TIMESTAMP WITH TIME ZONE NOT NULL;
It is possible to split the alter column, because currently all definitions of a column are in the same alter. Here is an exemple origin-table:
new-table :
the rollout result :
This result generate an syntax error.
The right query should be :
Thanks.