migrate
migrate copied to clipboard
Dropping spanner tables which has row deletion policy
Is your feature request related to a problem? Please describe. Currently, dropping will fail if spanner database has table with row deletion policy.
DDL:
CREATE TABLE Orders (
OrderId INT64,
CreatedAt TIMESTAMP,
) PRIMARY KEY (OrderId)
, ROW DELETION POLICY (OLDER_THAN(CreatedAt, INTERVAL 1 DAY))
Attempts to drop fail as follows:
% migrate -path db/migrations -database "spanner://projects/abc/instances/def/databases/testdb" down
Are you sure you want to drop the entire database schema? [y/N]
y
Dropping the entire database schema
error: rpc error: code = InvalidArgument desc = ROW DELETION POLICY will break if drop/alter column named CreatedAt in table Orders. Row Deletion Policy must be set on column of type TIMESTAMP. in line 0: DROP TABLE Orders; DROP TABLE SchemaMigrations
Describe the solution you'd like Drop row deletion policy before dropping table which has row deletion policy.
Describe alternatives you've considered Drop row deletion policy manually.