Skip to main content
Version: Next

Schema Feature Support

This page records d1pac's current desired-state coverage. SQLite and D1 support only a limited set of direct alterations, so many changes use a table rebuild: create a replacement table, copy same-named columns, replace the original, and recreate its indexes and triggers.

Tables and columns

FeatureStatusPlanned behavior
Create tableNativeCREATE TABLE; requires AllowCreate.
Drop tableDestructiveDROP TABLE; requires drop authorization.
Add trailing nullable/defaulted columnNativeALTER TABLE ... ADD COLUMN; requires AllowAlter.
Other column additionsMigrationTable rebuild; new constraints and defaults are validated.
Drop columnDestructiveTable rebuild copying remaining same-named columns; requires drop authorization.
Change type, default, or nullabilityMigrationTable rebuild copying same-named values into the desired definition.
Rename a columnNot inferredTreated as an added column plus a removed column; the old values are not copied.

Integrity constraints

FeatureStatusPlanned behavior
Primary keyMigrationTable rebuild and validation.
Foreign keyMigrationTable rebuild and validation.
Unique constraintMigrationTable rebuild and validation.
Check constraintMigrationTable rebuild and validation.
Referenced-table rebuildBlockedAutomatically blocked when another table references the target.

Other schema objects

FeatureStatusPlanned behavior
IndexCreate/drop/replaceDefinition changes use DROP INDEX followed by CREATE INDEX.
ViewCreate/drop/replaceDefinition changes use DROP VIEW followed by CREATE VIEW.
TriggerCreate/drop/replaceDefinition changes use DROP TRIGGER followed by CREATE TRIGGER.
Schemas, extensions, routines, enums, domains, sequencesNot applicableThese PostgreSQL object types are not part of SQLite/D1.
Object comments, owners, and privilegesNot modeledNo desired-state operations are planned for them.

Permissions and failure behavior

  • AllowCreate controls new objects.
  • AllowAlter controls direct alterations, replacements, and table rebuilds.
  • AllowDrop or --allow-drop controls removed objects and columns.
  • Disabled or unsafe operations remain visible as commented blocked-* plan entries.
  • UseTransaction="true" submits the change as one batch; existing values must satisfy the desired types and constraints.
  • Large rebuilds remain subject to Cloudflare D1 request and execution limits.
  • StopOnDataLossRisk is recorded but is not an additional enforcement gate.

See the safety model for rebuild and authorization details.