datalevin

Ahmed Hassan 2024-12-15T14:36:05.780289Z

How do we do schema migrations in Datalevin?

Ahmed Hassan 2024-12-15T14:47:14.594729Z

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

Huahai 2024-12-15T16:43:37.667239Z

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

Ahmed Hassan 2024-12-15T19:13:30.594029Z

what are examples of data changes?

Huahai 2024-12-15T19:21:27.726519Z

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
Huahai 2024-12-15T19:24:53.985029Z

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
Huahai 2024-12-15T19:26:07.370869Z

Attempting to do these will throw exception.

Huahai 2024-12-15T19:27:37.034699Z

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.

Huahai 2024-12-15T19:36:43.862429Z

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