4 ms·
The Haskell database-mapping library [1] "persistent" does auto-migrations as well. You declare your data types in a DSL reminiscent of SQL CREATE TABLE statem
by samstokes 13y ago
The Haskell database-mapping library [1] "persistent" does auto-migrations as well. You declare your data types in a DSL reminiscent of SQL CREATE TABLE statements. If you add a new data type, it creates the table; if you add a field, it adds the column; if you make a field optional, it changes the column to allow nulls.
It will only do that for non-destructive changes, so if you remove a column (which would lose data), or make an optional field non-optional (which is ill-defined if you had NULLs), it bails out with a message suggesting the SQL you should run to migrate manually.
[1] I can't really call it an ORM, since it maps to Haskell record types rather than _O_bjects, and it works with NoSQL databases as well as _R_elational databases.