causet migrations
Proposed:
causet migrationsis on the roadmap. In normal operation, DDL is applied automatically by the deployment process. The CLI commands are for manual and emergency use. See Roadmap.
Applies projection DDL from causet.projections.json to the tenant schema for a given platform/application/fork.
When You Need This
In normal operation, DDL is applied automatically when you deploy a release via the control plane — you do not need causet migrations apply for routine deployments.
Use causet migrations when:
- A deployment failed partway through and DDL was partially applied
- You need to apply a new IR to a fork without going through the release deploy UI
- Debugging schema state in a test or staging environment
- Emergency recovery after a schema drift was detected
causet migrations apply
Apply DDL from the active IR to the tenant schema.
causet migrations apply \
--platform my-platform \
--app concert-app \
--fork main \
--env productionWhat it does:
- Loads
causet.projections.jsonfrom the active release for the fork - Determines the target schema:
{platformId}_{applicationId}_{forkId} - Creates the schema if it does not exist
- For each projection:
CREATE TABLE IF NOT EXISTS,ADD COLUMN IF NOT EXISTS,CREATE INDEX IF NOT EXISTS
DDL is additive only. Existing columns, tables, and data are never removed. See Schema Evolution for handling column removal.
Flags:
| Flag | Description |
|---|---|
--platform <p> | Platform identifier (required) |
--app <a> | Application identifier (required) |
--fork <f> | Fork to target (required) |
--env <name> | Target environment |
--dry-run | Print DDL statements without executing |
--ir-path <path> | Use a local causet.projections.json instead of the active release |
Dry run example:
causet migrations apply \
--platform my-platform \
--app concert-app \
--fork main \
--env production \
--dry-runOutput:
-- Schema: my_platform_concert_app_main
CREATE SCHEMA IF NOT EXISTS my_platform_concert_app_main;
-- Projection: user_following
CREATE TABLE IF NOT EXISTS my_platform_concert_app_main.user_following (
user_id TEXT NOT NULL,
artist_id TEXT NOT NULL,
followed_at BIGINT,
PRIMARY KEY (user_id, artist_id)
);
CREATE INDEX IF NOT EXISTS idx_user_following_user_id
ON my_platform_concert_app_main.user_following (user_id);causet migrations status
Show pending vs applied migrations for a fork.
causet migrations status \
--platform my-platform \
--app concert-app \
--fork main \
--env productionExample output:
Schema: my_platform_concert_app_main
PROJECTION TABLE STATUS
user_following user_following ✓ applied
artist_show_directory artist_show_directory ✓ applied
venue_stats venue_stats ✕ missing
user_concert_memory user_concert_memory ✓ applied (missing 1 index)
1 table missing, 1 table missing indexes.
Run 'causet migrations apply' to apply pending changes.Limitations
- Column removal is not supported. Removing a field from the DSL does not drop the column. See Schema Evolution for the manual process.
- Primary key changes are not supported. A primary key change requires a new table, data migration, and swap.
causet migrations applywill not attempt this. - Data migrations are not managed. This tool manages schema shape only — transforming existing data is outside its scope.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All migrations applied successfully |
| 1 | One or more migrations failed |
| 2 | Invalid arguments or missing configuration |