Skip to main content

Change

Enum Change 

Source
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: Identifier

Schema name.

§comment: Option<String>

New comment value (None clears the comment).

§

CreateTable(Table)

Add a table.

§

DropTable

Drop a table.

Fields

§qname: QualifiedName

Table qname.

§row_count_estimate: Option<i64>

Best-effort estimate of row count, populated by the planner from pg_class.reltuples. The differ leaves this None.

§

AlterTable

Alter a table — column / constraint / comment operations.

Fields

§qname: QualifiedName

Target 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

§from: Index

The index as it exists in the target.

§to: Index

The index as it should exist in the source.

§

CreateSequence(Sequence)

Create a sequence.

§

DropSequence(QualifiedName)

Drop a sequence.

§

AlterSequence

Alter a sequence — per-field operations.

Fields

§qname: QualifiedName

Target 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: QualifiedName

Qualified name of the table owning the constraint.

§constraint: Identifier

Constraint 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: QualifiedName

Qualified 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: QualifiedName

Schema-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: CatalogObjectRef

The grantable object (kind + name + optional routine signature).

§grant: Grant

The full grant to apply.

§

RevokeObjectPrivilege

Revoke an object-level privilege from a grantable object (non-column).

Only emitted for managed grantees (see super::grants::diff_grants).

Fields

§object: CatalogObjectRef

The grantable object (kind + name + optional routine signature).

§grant: Grant

The full grant to revoke.

§

GrantColumnPrivilege

Grant a column-level privilege on a table, view, or materialized view.

Emitted when the grant’s columns field is Some(_).

Fields

§qname: QualifiedName

Qualified name of the table / view / materialized view.

§grant: Grant

The full grant (including the columns list).

§

RevokeColumnPrivilege

Revoke a column-level privilege from a table, view, or materialized view.

Only emitted for managed grantees.

Fields

§qname: QualifiedName

Qualified name of the table / view / materialized view.

§grant: Grant

The full grant (including the columns list).

§

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: Identifier

FOR ROLE x — the grantor role.

§schema: Option<Identifier>

IN SCHEMA y — scope. None = global.

§object_type: DefaultPrivObjectType

Object-type discriminant.

§direction: GrantDirection

Whether this step grants or revokes the privilege.

§grant: Grant

The grantee and privilege being adjusted.

§

CreatePolicy

Create a new policy on the named table.

Fields

§table: QualifiedName

Table the policy belongs to.

§policy: Policy

The policy to create.

§

DropPolicy

Drop a policy from the named table.

Fields

§table: QualifiedName

Table the policy belongs to.

§name: Identifier

Name 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.

Fields

§table: QualifiedName

Table the policy belongs to.

§policy: Policy

The desired policy state.

§

SetTableRowSecurity

Toggle a table’s ROW LEVEL SECURITY.

Fields

§qname: QualifiedName

Qualified name of the table.

§security: RowSecurity

Whether row-level security is enabled or disabled.

§

SetTableForceRowSecurity

Toggle a table’s FORCE ROW LEVEL SECURITY.

Fields

§qname: QualifiedName

Qualified name of the table.

§force: ForceRowSecurity

Whether 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: QualifiedName

Qualified name of the table.

§options: TableStorageOptions

Sparse 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: QualifiedName

Qualified name of the index.

§options: IndexStorageOptions

Sparse 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: QualifiedName

Qualified name of the materialized view.

§options: TableStorageOptions

Sparse 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.

Fields

§reason: String

Human-readable explanation of what changed and why it cannot be performed in-place.

Trait Implementations§

Source§

impl Clone for Change

Source§

fn clone(&self) -> Change

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Change

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Change

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Change

Source§

fn eq(&self, other: &Change) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Change

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Change

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.