kevlened / fireway

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

Example Project / Documentation #4

Closed IsaiahByDayah closed 4 years ago

IsaiahByDayah commented 4 years ago

Hey @kevlened, I really love that you've solved a problem I (and I imagine many others) have found ourselves with. I was wondering if you had an open-source project to show how this actually looks in practice (for example: how to handle failed migration data rollbacks, formatting longer descriptions in the migration filename, etc).

More than happy to help set up a skeleton project if that would help, but I wanted to see if you had something open already to look at. Thanks

kevlened commented 4 years ago

Hey @IsaiahByDayah, I'm glad you find it useful! Aside from the very basic tests in this repo, I don't have any examples, so if you'd like to set up a project, I'd gladly link to it in the README.

While I'm no longer working on the product that inspired fireway, I can describe our workflow.

That's what worked for us. Hope that's helpful.

IsaiahByDayah commented 4 years ago

Yes! This is extremely helpful. Thanks for clarifying things a bit more here.

Did you ever run into any race-condition issues? Like running a migration on prod when users may have been adding/removing data? I assume you could run transactions/batches in the migration but you still may miss any newly added documents no? Would you lock down clients somehow on deploys/migrations?

Just more poking around to try and cover all my bases with an approach like this and making sure I at least consider any potential bumps. Thanks again!

kevlened commented 4 years ago

Good question. Let's use an example:

Let's say you write a migration to rename first_name to firstName

By handling the scenario of outdated clients, we avoided migration race conditions.

IsaiahByDayah commented 4 years ago

Ahhh, ok. That makes a lot of sense. I've been toying with the idea of doing all writes via a web API for similar reasons so hearing that you guys also found that to be beneficial helps.

Awesome. Thanks again for sharing how you tackled some of these problems. I think it'll def help me with things in my project!

kevlened commented 4 years ago

Happy to help! You’ll also find that an api for mutations allows you to create document ids on the server, instead of allowing users to create any id they want on the client.

Good luck with your project.