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

Reverse migrations #49

Open
colinhowe opened this issue Oct 25, 2021 · 3 comments
Open

Reverse migrations #49

colinhowe opened this issue Oct 25, 2021 · 3 comments

Comments

@colinhowe
Copy link

Hi,

Have you had any thoughts on how you might want to do reverse migrations? I'm likely to have some time to implement this and would want to do it in a way that lines up with your plans.

@shawnfromportland
Copy link

I'm interested to know of plans of / support of this

@kevlened
Copy link
Owner

kevlened commented Feb 8, 2023

There isn't a way to do this automatically without storing a copy of the database (or the modified records) before the migration. It is possible to build your own rollback mechanism, but you'd have to fork the repo. That could look something like:

module.exports.migrate = async ({firestore, FieldValue}) => {
    await firestore.collection('name').add({key: FieldValue.serverTimestamp()});
};

module.exports.rollback = async ({firestore}) => {
    // perform your own rollback logic
};

I'm not using firestore anymore, so I don't have plans to add this feature.

@andersbc
Copy link

Hi @kevlend,
... I know it's a off topic, but would you care to comment on why you don't use firestore anymore.. maybe you found a better alternative? I ask because I like the real time aspect of firestore, but I really miss schemas, relations and mature toolings. Thank you :-)

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

4 participants