pub enum Change {
Show 47 variants
CreateSchema(Schema),
DropSchema(Identifier),
AlterSchema {
name: Identifier,
comment: Option<String>,
},
CreateTable(Table),
DropTable {
qname: QualifiedName,
row_count_estimate: Option<i64>,
},
AlterTable {
qname: QualifiedName,
ops: Vec<TableOpEntry>,
},
CreateIndex(Index),
DropIndex(QualifiedName),
ReplaceIndex {
from: Index,
to: Index,
},
CreateSequence(Sequence),
DropSequence(QualifiedName),
AlterSequence {
qname: QualifiedName,
ops: Vec<SequenceOpEntry>,
},
ValidateConstraint {
table: QualifiedName,
constraint: Identifier,
},
RecreateIndex {
qname: QualifiedName,
},
View(ViewChange),
AlterViewSetCheckOption {
qname: QualifiedName,
new_value: Option<CheckOption>,
},
Mv(MvChange),
UserType(UserTypeChange),
Function(FunctionChange),
Procedure(ProcedureChange),
Extension(ExtensionChange),
Trigger(TriggerChange),
Table(TableChange),
GrantObjectPrivilege {
object: CatalogObjectRef,
grant: Grant,
},
RevokeObjectPrivilege {
object: CatalogObjectRef,
grant: Grant,
},
GrantColumnPrivilege {
qname: QualifiedName,
grant: Grant,
},
RevokeColumnPrivilege {
qname: QualifiedName,
grant: Grant,
},
AlterObjectOwner(AlterObjectOwner),
AlterDefaultPrivileges {
target_role: Identifier,
schema: Option<Identifier>,
object_type: DefaultPrivObjectType,
direction: GrantDirection,
grant: Grant,
},
CreatePolicy {
table: QualifiedName,
policy: Policy,
},
DropPolicy {
table: QualifiedName,
name: Identifier,
},
AlterPolicy {
table: QualifiedName,
policy: Policy,
},
SetTableRowSecurity {
qname: QualifiedName,
security: RowSecurity,
},
SetTableForceRowSecurity {
qname: QualifiedName,
force: ForceRowSecurity,
},
SetTableStorage {
qname: QualifiedName,
options: TableStorageOptions,
},
SetIndexStorage {
qname: QualifiedName,
options: IndexStorageOptions,
},
SetMaterializedViewStorage {
qname: QualifiedName,
options: TableStorageOptions,
},
Publication(PublicationChange),
Subscription(SubscriptionChange),
EventTrigger(EventTriggerChange),
Statistic(StatisticChange),
Collation(CollationChange),
Aggregate(AggregateChange),
Cast(CastChange),
TsDictionary(TsDictionaryChange),
TsConfiguration(TsConfigurationChange),
UnsupportedDiff {
reason: String,
},
}Expand description
One structural change between two catalogs.
Change is intentionally not boxed: the enum’s footprint is dominated by
CreateTable / CreateIndex / ReplaceIndex payloads, but ChangeSet
only stores at most one of each per object, so Vec overhead is the
dominant cost and boxing would just add an extra allocation per entry.
Variants§
CreateSchema(Schema)
Add a schema.
DropSchema(Identifier)
Drop a schema by name.
AlterSchema
Update schema metadata (only comment in v0.1).
Fields
name: IdentifierSchema name.
CreateTable(Table)
Add a table.
DropTable
Drop a table.
Fields
qname: QualifiedNameTable qname.
AlterTable
Alter a table — column / constraint / comment operations.
Fields
qname: QualifiedNameTarget table qname.
ops: Vec<TableOpEntry>Per-table operations. Order is the planner’s job; the differ emits these in arbitrary order.
CreateIndex(Index)
Create an index.
DropIndex(QualifiedName)
Drop an index.
ReplaceIndex
Replace an index (DROP + CREATE) when a property change requires it.
Fields
CreateSequence(Sequence)
Create a sequence.
DropSequence(QualifiedName)
Drop a sequence.
AlterSequence
Alter a sequence — per-field operations.
Fields
qname: QualifiedNameTarget sequence qname.
ops: Vec<SequenceOpEntry>Per-sequence operations.
ValidateConstraint
A constraint exists in the catalog but is NOT VALID
(pg_constraint.convalidated = false). Planner emits
VALIDATE CONSTRAINT. Non-destructive.
Fields
table: QualifiedNameQualified name of the table owning the constraint.
constraint: IdentifierConstraint name.
RecreateIndex
An index exists in the catalog but is INVALID
(pg_index.indisvalid = false). Planner emits DROP INDEX + CREATE INDEX to rebuild it. Non-destructive.
Fields
qname: QualifiedNameQualified name of the invalid index.
View(ViewChange)
A view-level change.
AlterViewSetCheckOption
CREATE OR REPLACE VIEW … WITH [LOCAL|CASCADED] CHECK OPTION or the
inverse (set/unset check option on an existing view). PG has no direct
ALTER VIEW … SET CHECK OPTION; pgevolve emits a full
CREATE OR REPLACE VIEW carrying the new option.
Fields
qname: QualifiedNameSchema-qualified view name.
new_value: Option<CheckOption>The desired check option state in the source.
None = source declares no check option (clear it).
Mv(MvChange)
A materialized-view-level change.
UserType(UserTypeChange)
A user-defined type change (enum, domain, composite).
Function(FunctionChange)
A user-defined function change.
Procedure(ProcedureChange)
A user-defined procedure change.
Extension(ExtensionChange)
An extension change.
Trigger(TriggerChange)
A trigger change.
Table(TableChange)
A partition-membership change (ATTACH / DETACH PARTITION).
GrantObjectPrivilege
Grant an object-level privilege on a grantable object (non-column).
Emitted when a grant appears in source but not in the target catalog.
Fields
object: CatalogObjectRefThe grantable object (kind + name + optional routine signature).
RevokeObjectPrivilege
Revoke an object-level privilege from a grantable object (non-column).
Only emitted for managed grantees (see super::grants::diff_grants).
Fields
object: CatalogObjectRefThe grantable object (kind + name + optional routine signature).
GrantColumnPrivilege
Grant a column-level privilege on a table, view, or materialized view.
Emitted when the grant’s columns field is Some(_).
Fields
qname: QualifiedNameQualified name of the table / view / materialized view.
RevokeColumnPrivilege
Revoke a column-level privilege from a table, view, or materialized view.
Only emitted for managed grantees.
Fields
qname: QualifiedNameQualified name of the table / view / materialized view.
AlterObjectOwner(AlterObjectOwner)
Change the owner of a grantable object.
Emitted when the source declares an owner (owner: Some(_)) and the
target owner differs. When the source has owner: None, ownership is
unmanaged and no change is emitted.
AlterDefaultPrivileges
Add or remove a default privilege for a (FOR ROLE, IN SCHEMA?, object-type) key.
Fields
target_role: IdentifierFOR ROLE x — the grantor role.
schema: Option<Identifier>IN SCHEMA y — scope. None = global.
object_type: DefaultPrivObjectTypeObject-type discriminant.
direction: GrantDirectionWhether this step grants or revokes the privilege.
CreatePolicy
Create a new policy on the named table.
DropPolicy
Drop a policy from the named table.
Fields
table: QualifiedNameTable the policy belongs to.
name: IdentifierName of the policy to drop.
AlterPolicy
Alter a policy’s roles / USING / WITH CHECK.
Note: PG rejects ALTER POLICY when the command kind changes — the
differ emits DropPolicy + CreatePolicy in that case instead.
SetTableRowSecurity
Toggle a table’s ROW LEVEL SECURITY.
Fields
qname: QualifiedNameQualified name of the table.
security: RowSecurityWhether row-level security is enabled or disabled.
SetTableForceRowSecurity
Toggle a table’s FORCE ROW LEVEL SECURITY.
Fields
qname: QualifiedNameQualified name of the table.
force: ForceRowSecurityWhether row-level security is forced or not.
SetTableStorage
Set table storage reloptions. options carries the sparse delta — only
the fields whose source value differs from the catalog.
No Reset* variant: the lenient policy treats source None as “skip”.
Fields
qname: QualifiedNameQualified name of the table.
options: TableStorageOptionsSparse delta of options to apply.
SetIndexStorage
Set index storage reloptions. Sparse delta.
No Reset* variant: the lenient policy treats source None as “skip”.
Fields
qname: QualifiedNameQualified name of the index.
options: IndexStorageOptionsSparse delta of options to apply.
SetMaterializedViewStorage
Set materialized view storage reloptions. Sparse delta.
No Reset* variant: the lenient policy treats source None as “skip”.
Fields
qname: QualifiedNameQualified name of the materialized view.
options: TableStorageOptionsSparse delta of options to apply.
Publication(PublicationChange)
A nested change to a single publication. See PublicationChange.
Subscription(SubscriptionChange)
A nested change to a single subscription. See SubscriptionChange.
EventTrigger(EventTriggerChange)
A change to an event trigger. See EventTriggerChange.
Statistic(StatisticChange)
A nested change to a single statistic. See StatisticChange.
Collation(CollationChange)
A nested change to a single collation. See CollationChange.
Aggregate(AggregateChange)
A nested change to a single aggregate. See AggregateChange.
Cast(CastChange)
A nested change to a single cast. See CastChange.
TsDictionary(TsDictionaryChange)
A nested change to a single text-search dictionary. See TsDictionaryChange.
TsConfiguration(TsConfigurationChange)
A nested change to a single text-search configuration. See TsConfigurationChange.
UnsupportedDiff
A change that cannot be performed in-place.
Emitted by the differ when it detects a structural difference that has
no safe automatic migration path (e.g., changing a table’s PARTITION BY
clause). The ordering phase converts this into a PlanError so the
plan never reaches execution.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Change
impl<'de> Deserialize<'de> for Change
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Change
Auto Trait Implementations§
impl Freeze for Change
impl RefUnwindSafe for Change
impl Send for Change
impl Sync for Change
impl Unpin for Change
impl UnsafeUnpin for Change
impl UnwindSafe for Change
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more