4 ms·
> why isn’t data definition — which is a much better fit, in my opinion, for a declarative model — also declarative? My opinion on this one point (apart from D
by aargh_aargh 6y ago
> why isn’t data definition — which is a much better fit, in my opinion, for a declarative model — also declarative?
My opinion on this one point (apart from DDL being ossified by the ISO standards) is that DDL being imperative is useful because it's used in migrations and imperative approach gives you more control over protecting existing data (i.e. not just the schema).
Some contrived examples:
1) shortening a varchar - are you sure you want to just trim the values or do you want to have the option of doing something with them?
2) renaming a column - would have to be a explicit, a special case in declarative DDL
3) dropping a column - maybe you want to transform the existing values instead of just throwing them away
Sure, it could all be probably handled even in a declarative DDL. My point is that in declarative DDL you would have to think to explicitly protect your data. In imperative DDL you see what you are doing.
- erik_seaberg 6y agoWhat I'd like to see is: here is the desired schema, please compare it to the old schema and propose what to do that doesn't irreversibly destroy any information unless we say to.