4 ms·
Multiple reasons. Let me start with one: Flexibility. I can add a new attribute the very moment I create a new row. When I want to add "not_available_before:
by TekMol 2y ago
Multiple reasons. Let me start with one: Flexibility.
I can add a new attribute the very moment I create a new row.
When I want to add "not_available_before: 2026" to a car, I can do that right away. No need to alter the table and add a new column.
- rafram 2y agoThat just seems like it encourages bad practices. There’s nothing but upside to tracking your schema changes.
- MrLeap 2y agoCognitive overhead is a cost!
- TekMol 2y agoWhat do you mean by "tracking"? So far, we have not talked about tracking anything. Only about how to add a new field. I just named a downside of the columns approach: It slows things down. Being able to add add fields faster leads to faster experimentation and development.
- Althorion 2y agoI mean, sometime along the way you’re going to have something that consumes the data (otherwise, why bother keeping it in the first place), and that something will have certain expectations about the way things are structured. It will probably become a good idea then to have some clue as to what structure used to be at one point or the other, and for that you’d want to keep track as to what got added/removed and when. If it’s a very early stage in the development, and you don’t expect any of the current data to survive to the final version, I guess that’s fine. But when you have an actual running product that has to keep running, dealing with the multiple versions of the data scheme is a pain, and dealing with the multiple untracked versions of the data scheme is a pain squared.
- TekMol 2y agoHow does "have some clue as to what structure used to be at one point or the other" relate to the topic of columns vs json fields?
- Althorion 2y agoIt is what they meant by ‘tracking’, which is what you’ve asked about.
- TekMol 2y agoI have the feeling you both are confusing your development workflow around database structure with the structure itself. You seem to think that using columns somehow results in some type of automatic "tracking" (versioning?) of something.
- Althorion 2y agoNot quite. We are saying that adding `not_available_before: 2026`, or similar, ‘right away’ is usually not a good thing; therefore anything that helps with doing that is not something we desire. It should be a multistep process. Yes, it will waste time now, but it will save it in a long run.
- TekMol 2y agoHow will it save time in the long run?
- jitl 2y agoI use a lot of JSON columns w/ SQLite and find a programming language type is a great way to specify schema for such a column without having to write any migrations. No one has written a sternly worded comment at me on the internet yet for adding or removing fields from my struct types without writing a separate migration file. Lots of use-cases for SQLite are not like Big Iron SQL Database Of Record where every change must be tracked because it's a shared stateful single point of failure and there's hell to pay for mistakes or confusion.