docs(faq): add note on using Emigrate for existing databases

This commit is contained in:
Joakim Carlstein 2024-02-06 09:29:53 +01:00
parent b62c692846
commit e7ec75d9e1
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@emigrate/docs': minor
---
Add note in FAQ on using Emigrate for existing databases

View file

@ -3,11 +3,13 @@ title: "FAQ"
description: "Frequently asked questions about Emigrate." description: "Frequently asked questions about Emigrate."
--- ---
import Link from '@components/Link.astro';
## Why no `down` migrations? ## Why no `down` migrations?
> Always forward never backwards. > Always forward never backwards.
Many other migration tools support `down` migrations, but in all the years we have been Many other migration tools support `down` (or undo) migrations, but in all the years we have been
doing migrations we have never needed to rollback a migration in production, doing migrations we have never needed to rollback a migration in production,
in that case we would just write a new migration to fix the problem. in that case we would just write a new migration to fix the problem.
@ -17,3 +19,7 @@ and in such case you just revert the migration manually and fix the `up` migrati
The benefit of this is that you don't have to worry about writing `down` migrations, and you can focus on writing the `up` migrations. The benefit of this is that you don't have to worry about writing `down` migrations, and you can focus on writing the `up` migrations.
This way you will only ever have to write `down` migrations when they are really necessary instead of for every migration This way you will only ever have to write `down` migrations when they are really necessary instead of for every migration
(which makes it the exception rather than the rule, which is closer to the truth). (which makes it the exception rather than the rule, which is closer to the truth).
## Can I use Emigrate with my existing database?
Yes, you can use Emigrate with an existing database. See the <Link href="/guides/baseline/">Baseline guide</Link> for more information.