3 ms·
I would love a system that is schema-less by design, but has guards that can be enforced at insert/update. That way, the underlying data structures don't have t
by m0th87 14y ago
I would love a system that is schema-less by design, but has guards that can be enforced at insert/update. That way, the underlying data structures don't have to be locked up from complex migrations (as needed w/ ALTER TABLE), but you still get type safety. A migration instead would simply involve a change in guards and an asynchronous update of existing entries. Plus you'd get all the wins of something resembling optional types: you only enforce guards if you want.
- jdoliner 14y agoThis is a feature we've talked a lot about. Another idea we think is interesting is having the database detect schema such that users could see a readout that said: 100% of your documents have a integer field named "foo" would you like to make this a schema constraint?
- rgarcia 14y agoAt Clever we do this with mongo + mongoose. Mongoose is janky in places but it's great for type safety and migrations like you describe.