Automatic Migrations
When you republish a module to an existing database using spacetime publish {database-name}, SpacetimeDB attempts to automatically migrate your database schema to match the new module definition. This allows you to update your module code and redeploy without losing existing data, as long as the changes are compatible.
note
The "schema" refers to the collection of tables, reducers, procedures, views, and the types they depend on that are declared in your module code.
✅ Safe Changes (Always Allowed)
The following changes are always allowed and will not break existing clients:
- Adding new tables. Non-updated clients will not be able to see them.
- Adding indexes.
- Adding or removing
Auto Incannotations. - Changing tables from private to public.
- Adding new reducers.
- Removing
Uniqueconstraints.