Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Migrate a database without downtime #1730

Closed
jferrettiboke opened this issue Jan 25, 2018 · 2 comments
Closed

Migrate a database without downtime #1730

jferrettiboke opened this issue Jan 25, 2018 · 2 comments

Comments

@jferrettiboke
Copy link

Hi guys.

What about migrating a database without downtime on production? I think we should start planning this to avoid catastrophes within the production database.

I know Prisma offers some mechanisms to alter data structure but I feel like it is not enough. I mean it is not a smooth transition. Let me explain you why.

Imagine an API processes many requests to make payments. It could be catastrophic if you deploy exactly at the same moment that the API is processing data and other requests to external services on behalf of the users. You could also have other good reasons, among others, such as don't bother users with internal errors and giving them a bad experience, or just don't interrupt your sales and keep making money.

Whatever your reason is, in order to avoid this, there are patterns when migrating a database without downtime (you could want to read more about this).

Could it be possible to avoid these issues and automate the transition in a better way without downtime?

@sorenbs
Copy link
Member

sorenbs commented Jan 27, 2018

Thanks for bringing this up @jferrettiboke

The first link from your google search is a good primer on migrating databases without downtime. https://dzone.com/articles/safe-database-migration-pattern-without-downtime
It is a pattern that can be applied to any database including Prisma. It is quite a lot of work to do, so that is why we don't require Prisma users to follow a pattern like this.

We will document these patterns better in the future, and maybe add features that makes it easier to achieve zero-downtime deployments for complex changes to your data schema.

@stale
Copy link

stale bot commented Aug 9, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale Marked as state by the GitHub stalebot label Aug 9, 2018
@stale stale bot closed this as completed Aug 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants