Skip to content

Dropping spanner tables which has row deletion policy #844

New issue

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

Open
toga4 opened this issue Oct 28, 2022 · 0 comments · May be fixed by #845
Open

Dropping spanner tables which has row deletion policy #844

toga4 opened this issue Oct 28, 2022 · 0 comments · May be fixed by #845

Comments

@toga4
Copy link

toga4 commented Oct 28, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant