3 ms·
It's even better: with an explicit schema you can trivially do data migrations! With something without a schema, data migrations are almost impossible to do co
by lucian1900 13y ago
It's even better: with an explicit schema you can trivially do data migrations!
With something without a schema, data migrations are almost impossible to do correctly.
- danpalmer 13y agoI think trivially is over simplifying it, but certainly migrations are much easier with a schema.
- threeseed 13y agoData migrations are rarely just about adding or removing a few columns. It also involves data manipulation. Schema doesn't help you with this. So at some point you have to write data migration code. In which case (and if you are using an ORM) why not do the schema change at the same time. And sorry but it is complete nonsense to suggest that data migrations are almost impossible on schema less systems. I've done countless myself and people are doing it every day.
- lucian1900 13y agoHaving a schema most certainly does help, since you can know with certainty what shape a specific record has before retrieving it. If you have an ORM for your schema-less database, you get roughly the same thing, but with weaker guarantees. Correct data migration requires knowledge of the schema of the data.
- angrybits 13y agoRelational models are well-described and can be changed transactionally, both in structure and content, using a well-known and ubiquitous language to describe the migration. It doesn't get any easier than that.
- mercurial 13y ago> Relational models are well-described and can be changed transactionally, * *: transactionally, for certain flavours of relational databases.
- mercurial 13y ago> Data migrations are rarely just about adding or removing a few columns. This has not been my experience. Sure, you occasionally need code to do a migration. But at least 90% of the time, you are adding to or refactoring your existing data model. In which case, pure SQL is entirely sufficient, unless you've been doing untoward things with your schema.