23 December 2013
Datomic is a database that has flexible, minimal schema. Starting with version 0.9.4470, available here, we have added the ability to alter existing schema attributes after they are first defined. You can alter schema to
- rename attributes
- rename your own programmatic identities (uses of :db/ident)
- add or remove indexes
- add or remove uniqueness constraints
- change attribute cardinality
- change whether history is retained for an attribute
- change whether an attribute is treated as a component
Schema alterations use the same transaction API as all other transactions, just as schema installation does. All schema alterations can be performed while a database is online, without requiring database downtime. Most schema changes are effective immediately, at the end of the transaction. There is one exception: adding an index requires a background job to build the new index. You can use the new syncSchema API
for detecting when a schema change is available.
When renaming an attribute or identity, you can continue to use the old name as long as you haven't repurposed it. This allows for incremental application updating.
See the schema alteration docs
for the details.
Schema alteration has been our most requested enhancement. We hope you find it useful and look forward to your feedback.