datalevin 2024-12-15

How do we do schema migrations in Datalevin?

it seems like datalevin.core/update-schema does this?

yes. As long as the schema migration does not require data changes, it is supported.

what are examples of data changes?

for example, you want to change a data type from long to string. But your data is already in the DB with longs. That's not supported right now. Such migration is on the roadmap.

👍 1

Right now, these three types of changes are not supported (when data is already populated): 1 cardinality change from many to one 2. data type changes as mentioned above 3. uniqueness change when data is already not unique

👍 1

Attempting to do these will throw exception.

In the future, we can support such migration by asking user to specify how they want to do these changes. Probably by specifying a function, etc. TBD.

Right now, any schema changes that are consistent with existing data is supported, e.g. rename an attribute, delete unused attribute, add attribute, etc.

👍 1