SleekSky Developers

Data and migrations

Migrations only add

Numbered .sql files in migrations/, applied to DB in order. New tables, new columns (nullable or with a default), new indexes. Never DROP, RENAME or change a column's meaning: the release script refuses it unless given --allow-destructive "<reason>".

Release 2 migrations run (schema 2)Release 2 code deployedRelease 1 runningFor a moment, release 1 code runs on schema 2Rollback within 7 days: release 1 code returns, schema 2 staysDatabaseRelease 1 codeRelease 2 codeDatabaseRelease 1 codeRelease 2 code

Migrations run before new code is deployed, and code can be rolled back for 7 days while the schema stays. So new code must work on the previous release's data, and the previous release must keep working with the new schema. Read new columns defensively.

All data stays in the instance's own D1, R2 and KV, and counts toward the product's storage allowance. Near it, owners are warned; over it, your app's init answers "storage": "over".

Cloning

With clone in the manifest, owners can clone an instance: a new one on the original's release, with its data copied in.

  • Database: exported and imported whole; tables in skip_tables are then emptied.
  • Files: the buckets r2 names are copied; others start empty. KV starts empty. Durable Object storage can't be copied: don't add clone if you keep lasting data there.
  • Secrets: random and vapid are new unless listed in copy_secrets (list the ones that encrypt stored data).
  • Knowing it's a copy: the copy's init returns its own new id. Store your app id; when init returns a different one, your data came from another app, so clean up what belonged to the original.
  • Not copied: address, custom domains, owners and analytics.