Skip to content
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

Support for Spanner DB schema migrations #2082

Comments

@SargisPlusPlus
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

We use google_spanner_database DDL functionality to define schema for our database. When schema changes, new tables are added or removed, entire database has to be destroyed and recreated for the new changes to be applied. It would be nice not to destroy entire database when schema changes are introduced but instead run migrations to change schema accordingly.

New or Affected Resource(s)

  • google_spanner_database
@rakyll
Copy link

rakyll commented Jul 9, 2020

@SargisPlusPlus we (the Cloud Spanner team) was just looking into this because we think we shouldn't destroy any resources for DDL updates.

Recently, we have been working on schema migration tool support lately (e.g. Flyway, Liquibase, etc). We also discussed whether Terraform is a good place for this but given provisioning is not always in the path of development and Terraform itself doesn't have the sophisticated capabilities that you mention, we were thinking about sticking to get the migration tool integrations right. How does that sound?

@nielm
Copy link

nielm commented Jul 23, 2020

I wrote: https://github.com/GoogleCloudPlatform/spanner-schema-diff-tool as a way of generating non-destructive alter statements to migrate schemas...

@danawillow danawillow modified the milestones: Near-Term Goals, Sprint 19 Aug 3, 2020
@danawillow
Copy link
Contributor

@rakyll I noticed you're now proposing that people not manage their schema in TF at all. I think this is probably smart- writing ALTER statements isn't really a great fit for a declarative tool, since it means the same config can't be applied to a blank slate to create the same environment.

We'll probably still want to have update support for these statements anyway though so that people who wish to perform updates through Terraform can do so and also so people who aren't paying attention don't accidentally delete their databases. That work is allocated for our next sprint (Aug 17-31)

@ghost
Copy link

ghost commented Oct 16, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.