3 ms·
Imagine the database schema migrations...
by ezekg 5y ago
Imagine the database schema migrations...
- jagged-chisel 5y agothe good news is by the time you get to the 100th client, you'll likely have run into all possible bugs and the remaining 6900 will be pretty smooth.
- Spivak 5y agoHaving worked at shops that used this architecture it's really not that bad. Can you write the code to do one schema migration? Great, now you can do 1000. App server boots and runs the schema migrations, drops privs and launches the app. Now you've staved off your scaling issues from "how to have a db large enough to hold all our customer data" to "how to have a db large enough to hold our biggest customer's data." Much easier.
- robertlagrant 5y agoYou can write the code to do 1000 schema migrations, but the problem is if you've migrated 40% of them and hit an issue. What do?
- spookthesunset 5y agoOne of the many reasons to put good constrains on fields and use referential integrity! If you don't let the database enforce data validity you are gonna get fucked at some point! source: every single place I've worked at that poo-poos referential integrity has a database that is full of bullshit that "the application code" never cleaned up Always use referential integrity. The people who are against it almost always are against it for superstitious reasons (eg: "it makes things slow" or "only one codebase calls it so the code can enforce the integrity"). All it takes is exactly one bug in the application code to corrupt the whole damn thing. And that bug will happen over the lifetime of the product regardless of how "good" or "awesome" the programmers think they are.... ... I'll get off my soapbox now!
- robertlagrant 5y agoThat's one thing yes. What if there's a transient network error, or the DB runs out of memory, and now you have some data in an old state and some in a new. You're lecturing about table design. I'm talking about more general transactionality over any errors.