kevlened / fireway

A schema migration tool for firestore
MIT License
277 stars 41 forks source link

Reverse migrations #49

Open colinhowe opened 2 years ago

colinhowe commented 2 years ago

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 commented 1 year ago

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

kevlened commented 1 year ago

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 commented 1 year ago

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 :-)