Operators
Every schema modification operator, by name, with its category and a one-line summary.
The last five columns name the commands that work with operators and say, for each, whether
it handles the operator in this version: available or not available. For an operator’s full
reference, run retrofit op info <operator>.
| Operator | Category | Summary | op add | import | drift | snapshot | migrate |
|---|---|---|---|---|---|---|---|
AddCheck | constraint | Declare a CHECK constraint enforcing a row-level predicate. | available | available | available | available | available |
AddColumn | column | Add a column to an existing table. | available | available | available | available | available |
AddEnumValue | type | Append a new value to an existing enum type. | available | available | not available | available | available |
AddExclude | constraint | Declare an EXCLUDE constraint: no two rows’ keys may all compare true under the listed operators. | available | available | available | available | available |
AddForeignKey | constraint | Declare a foreign-key constraint to referenced_columns in referenced_table. | available | available | available | available | available |
AddIdentity | column | Promote an existing column to GENERATED { BY DEFAULT | ALWAYS } AS IDENTITY. PG mints a fresh backing sequence starting at identity_start (else PostgreSQL’s default: its minimum value, or its maximum when it counts down) and does NOT advance it past the column’s existing values, so migrate emits a realignment statement after the ALTER; without it the migration applies cleanly and the next insert collides. | available | available | available | available | available |
AddNotNull | column | Set the column’s NOT NULL bit on the column vertex. | available | available | available | available | available |
AddPrimaryKey | constraint | Declare a primary-key constraint over the listed columns. | available | available | available | available | available |
AddUnique | constraint | Declare a UNIQUE constraint over the listed columns. | available | available | available | available | available |
AttachPartition | table | Subordinate a free-standing table as a partition of a partitioned parent (its columns end into the parent’s). | available | available | available | available | available |
CastColumn | column | Change a column’s SQL type in place. | available | available | available | available | available |
ChangePrimaryKey | constraint | Replace a table’s primary key with a new column set; preserves the cascade genealogy across the PK and every dependent FK constraint via N+1 EdgeKindCrossElement edges minted at replay. | available | available | available | available | available |
CopyColumn | column | Duplicate a column on the same parent table: mint a fresh column whose initial values are seeded from an existing source column. Type/default/nullability are inherited from the source unless overridden. The new column is born unconstrained; re-attach PK/FK/UNIQUE/CHECK/index against the new ElementID via separate ops. | available | not available | not available | available | available |
CopyTable | table | Create a new table that is an independent copy of source. | available | not available | available | available | available |
CreateExtension | root | Install a PostgreSQL extension at the cluster (database) level. | available | available | available | available | available |
CreateFunction | function | Create a new function inside the target schema. Identity is (schema, composite-name). | available | available | available | available | available |
CreateIndex | index | Create a physical index over the listed columns. | available | available | available | available | available |
CreateMaterializedView | view | Create a new materialized view inside the target schema. | available | available | available | available | available |
CreatePartition | table | Create a partition under a partitioned parent (columns inherited). | available | available | available | available | available |
CreatePolicy | policy | Create a row-level-security policy on a table. Identity is (table, name). | available | available | available | available | available |
CreateSchema | root | Mint the root schema element. | available | available | not available | available | available |
CreateTable | table | Create a new table inside the target schema. | available | available | available | available | available |
CreateTrigger | trigger | Create a trigger on a table or view. Identity is (table, name). | available | available | available | available | available |
CreateType | type | Create a user-defined type (enum or composite) in the target schema. | available | available | not available | available | available |
CreateView | view | Create a new view inside the target schema. | available | available | available | available | available |
DeclareReversal | log | Declare how a sealed RunRawScript is undone: a reverse_body, a no-op or forward-only with its reason, or (with no arm) a withdrawal of the declaration it supersedes. | available | not available | not available | not available | not available |
DepartitionTable | table | Flatten a partitioned parent back to a plain heap, tombstoning its partition-children. | available | not available | available | available | available |
DetachPartition | table | Detach a partition into a free-standing table (rows kept). | available | available | available | available | available |
DisableTrigger | trigger | Disable an enabled trigger. | available | available | available | available | available |
DropCheck | constraint | Consume the target CHECK constraint. | available | available | available | available | available |
DropColumn | column | Consume the target column element. | available | available | available | available | available |
DropDefault | column | Clear a column’s DEFAULT expression. Replay rejects against a column with no current default. | available | available | available | available | available |
DropExclude | constraint | Consume the target EXCLUDE constraint. | available | available | available | available | available |
DropExtension | root | Drop a PostgreSQL extension. | available | available | available | available | available |
DropForeignKey | constraint | Consume the target foreign-key constraint. | available | available | available | available | available |
DropFunction | function | Consume the target function element. | available | available | available | available | available |
DropGeneratedExpression | column | Clear a stored generated column’s expression, converting it to a base column. Replay rejects against a column with no current generated expression or a virtual generated column. | available | available | available | available | available |
DropIdentity | column | Remove the identity property from a column. The implicit NOT NULL is preserved; use DropNotNull to clear it. | available | available | available | available | available |
DropIndex | index | Consume the target index element. | available | available | available | available | available |
DropMaterializedView | view | Consume the target materialized view element. | available | available | available | available | available |
DropNotNull | column | Clear the column-vertex NOT NULL bit. | available | available | available | available | available |
DropPolicy | policy | Consume the target policy element. | available | available | available | available | available |
DropPrimaryKey | constraint | Consume the target primary-key constraint. | available | available | available | available | available |
DropTable | table | Consume the target table element. | available | available | available | available | available |
DropTrigger | trigger | Consume the target trigger element. | available | available | available | available | available |
DropType | type | Consume a user-defined type element. Refused at op-add when any live column binds to it. | available | available | available | available | available |
DropUnique | constraint | Consume the target UNIQUE constraint. | available | available | available | available | available |
DropView | view | Consume the target view element. | available | available | available | available | available |
EnableTrigger | trigger | Enable a disabled trigger. | available | available | available | available | available |
ExtractTable | table | Extract columns into new related tables (column-axis split; normalizes a wide table). A child copies the source’s primary key, keeping every row’s data, or designates key columns it shares with the source (the lookup: one child row per distinct key, the source rows with a NULL key component losing their moved values). With a remainder the source survives in place holding the unassigned columns; with every live column assigned the source is consumed. | available | available | available | available | available |
InlineTable | table | Inline one or more child tables back into a live table along their primary keys (keyed column fold, folding an extracted child back into its survivor). The survivor keeps its identity; each inlined source’s columns reparent onto it and the source is consumed. A survivor row with no inlined row is padded with NULL or the column’s default. | available | not available | not available | available | available |
JoinTable | table | Join two tables’ columns into one (denormalize; column-axis join along a recorded key pairing). Identity-preserving at the column level: each source column is reparented to the new target with its existing ElementID. Rejects on column-name collision across sources (resolve via prior RenameColumn). The key_pairs are the ordered column pairs the sources are joined on (each side’s columns a PRIMARY KEY or UNIQUE of that source); kind picks the JOIN flavor (inner/left/right/full). | available | not available | available | available | available |
MergeTable | table | Move the rows of several tables into a live table of their shape, one predicate recorded per source (row-axis merge). | available | not available | available | available | available |
MoveColumn | table | Move a column to another table along a recorded key pairing, keeping its identity and carrying each value to its partner row. The column’s ElementID survives the move; only the parent table changes. Renames are a separate operator. | available | available | available | available | available |
PartitionTable | table | Convert a plain table to a partitioned parent in place, minting N partitions atomically. | available | not available | available | available | available |
RenameColumn | column | Rename the target column inside its containing table. | available | available | available | available | available |
RenameConstraint | constraint | Rename a constraint without dropping it. Element identity is preserved; the first rename of a PG-default-named constraint assigns the first explicit name. | available | available | available | available | available |
RenameEnumValue | type | Rename an existing enum value in place. | available | available | not available | available | available |
RenameFunction | function | Rename the target function to a new name in its schema. | available | available | available | available | available |
RenameIndex | index | Rename the target index inside its containing table. | available | available | available | available | available |
RenameMaterializedView | view | Rename the target materialized view to a new name in its schema. | available | available | available | available | available |
RenameOwnedSequence | column | Rename the sequence a column owns (its serial or identity sequence) without touching the column. | available | available | available | available | available |
RenamePolicy | policy | Rename a policy within its owning table. | available | available | available | available | available |
RenameTable | table | Rename the target table to a new name in its schema. | available | available | available | available | available |
RenameTrigger | trigger | Rename the target trigger. | available | available | available | available | available |
RenameType | type | Rename a user-defined type. Element identity (typeRef) is preserved across the rename. | available | available | not available | available | available |
RenameView | view | Rename the target view to a new name in its schema. | available | available | available | available | available |
ReplaceFunction | function | Replace a function’s body and mutable attributes. Signature is identity-fixed by on= and cannot change. | available | available | available | available | available |
ReplaceMaterializedView | view | Replace the body of an existing materialized view (DROP CASCADE + CREATE realization). | available | not available | available | available | available |
ReplacePolicy | policy | Replace a policy’s TO / USING / WITH CHECK. Cannot change permissive or command (those are identity-fixed; use Drop+Create). | available | available | available | available | available |
ReplaceView | view | State the view’s whole new definition: query and column list, same element. | available | available | available | available | available |
RunRawScript | opaque | Run-once raw statement sequence with no catalog identity (a DO $$ … $$; anonymous block). A body or reverse_body whose every name binds is bound to the elements it names: migrate renders each as its element’s name at the script’s position, so a rename before it is followed and a drop before it refuses; dynamic SQL, names as data, or a form the binder does not follow keeps a body opaque, emitted verbatim, with a finding naming the cause. migrate --down reads its reversal: an optional reverse_body is emitted unchecked, reverse_noop contributes nothing, reverse_blocked refuses; no structural diff target; drift has no synthesis path. The escape hatch below the Structural/Definitional partition. | available | available | not available | available | available |
Seal | log | Mark a range of prior ops as sealed (immutable, Merkle-digested). | available | available | not available | not available | available |
SetColumnComment | column | Set or clear a column comment. Empty text clears. | available | available | available | available | available |
SetConstraintComment | constraint | Set or clear a constraint comment. Empty text clears (mirrors PG COMMENT ON CONSTRAINT … ON … IS NULL). | available | available | available | available | available |
SetConstraintDeferrable | constraint | Toggle the DEFERRABLE bit on an FK constraint (PG’s ALTER CONSTRAINT is FK-only; UNIQUE / PK can be born deferrable via AddUnique / AddPrimaryKey but not toggled post-birth). Replay rejects no-op writes. | available | available | available | available | available |
SetConstraintEnforced | constraint | Toggle the ENFORCED bit on a foreign-key (FK) constraint (PostgreSQL alters the enforceability of foreign keys only). | not available | not available | not available | not available | not available |
SetConstraintInherit | constraint | Toggle the NO INHERIT bit on a NOT NULL constraint (PostgreSQL’s per-constraint INHERIT / NO INHERIT applies to NOT NULL only). | not available | not available | not available | not available | not available |
SetConstraintInitiallyDeferred | constraint | Toggle the INITIALLY DEFERRED bit on an FK constraint (PG’s ALTER CONSTRAINT is FK-only; UNIQUE / PK can be born initially-deferred via AddUnique / AddPrimaryKey but not toggled post-birth). Requires the constraint to already be DEFERRABLE; replay rejects no-op writes. | available | available | available | available | available |
SetDefault | column | Set or replace a column’s DEFAULT expression. Single-slot semantics; overwrites whatever default is in effect. | available | available | available | available | available |
SetFunctionComment | function | Set or clear a function comment. Empty text clears (mirrors PG COMMENT ON FUNCTION … IS NULL). | available | available | available | available | available |
SetIdentityGeneration | column | Swap an identity column’s generation mode between BY DEFAULT and ALWAYS without dropping the underlying sequence. | available | available | available | available | available |
SetIdentityOptions | column | Change an identity column’s sequence options (START, INCREMENT, MINVALUE, MAXVALUE, CACHE, CYCLE); an option it does not name keeps its value, and the sequence keeps its position. | available | available | available | available | available |
SetReferenceData | table | Declare or undeclare the target table as reference data. | available | not available | not available | not available | not available |
SetReplicaIdentity | table | Set the table’s REPLICA IDENTITY mode. mode=using_index requires index=<index>, a unique, immediate, non-partial, column-only index on this table over NOT NULL columns. | available | available | available | available | available |
SetRowLevelSecurity | policy | Set a table’s ROW LEVEL SECURITY enabled/forced facets (absolute {enabled, forced} payload). | available | available | available | available | available |
SetTableComment | table | Set or clear a table comment. Empty text clears (mirrors PG COMMENT ON TABLE … IS NULL). | available | available | available | available | available |
SplitTable | table | Move a table’s rows into N new tables of its shape by first-match predicate; the source stays (row-axis split). | available | not available | not available | available | available |
UnjoinTable | table | Take a join apart along the keys its sides hold into two new related tables (keyed table unjoin, undoing a join of any kind). Every live column of the source is assigned to exactly one child and the source is consumed; each child keeps its columns’ identities. | available | not available | not available | available | available |
ValidateConstraint | constraint | Promote a NOT VALID foreign-key or CHECK constraint to validated. | available | available | available | available | available |
WitnessReferenceData | table | Attest a reference-data record’s bytes at its key (written by retrofit data witness). | available | not available | not available | not available | not available |