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

Let's talk about migrations... #146

Open
bdunne opened this issue Jan 9, 2020 · 2 comments
Open

Let's talk about migrations... #146

bdunne opened this issue Jan 9, 2020 · 2 comments

Comments

@bdunne
Copy link
Contributor

bdunne commented Jan 9, 2020

Scenario: You have an app running. You create some new migrations and change code to depend on those migrations. During the new deploy, migrations fail. What should happen?

Migration 1: add a new column (unlikely to fail)

  • Failure: the old pod is still in a good state and can successfully handle traffic. If the new pod were brought up at this point, it would probably be bad. (errors from missing columns)
  • Success, the old pod is still in a good state and can successfully handle traffic. If the new pod were brought up at this point, its responses would probably be at least somewhat incorrect (new column has no data.

Migration 2: move data from an old column into the new column (most likely to fail)

  • Failure: Transaction rollback, same state as Migration 1 success
  • Success: the old pod is now in a somewhat bad state (old column has no data), new pod would probably be okay now.

Migration 3: delete the old column (unlikely to fail)

  • Failure: Transaction rollback, same state as Migration 2 success
  • Success: Old pod is now in a bad state (missing column), new pod is in good state

Should we make the API pod fail to start if migrations fail? If seed fails?

@bdunne
Copy link
Contributor Author

bdunne commented Jan 9, 2020

I think it should fail to start the rails server if migrations fail.

@lindgrenj6
Copy link
Contributor

I agree with @bdunne, I'm a big fan of having the pod fail x times and go into the CrashLoopBackoff state rather than coercing the user into thinking everything is mostly ok when the database hasn't been migrated.

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

No branches or pull requests

2 participants