Skip to main content

PackTableReplacement

Struct PackTableReplacement 

Source
pub struct PackTableReplacement {
    pub table: &'static str,
    pub marker: &'static str,
    pub columns: &'static [&'static str],
    pub rebuilds: &'static [&'static str],
    pub script: &'static str,
}
Expand description

A declared rebuild of pack-owned auxiliary tables whose CHECK constraints change (ADR-028 Amendment A7).

CREATE TABLE IF NOT EXISTS keeps the checks a table was created with, so a pack that widens one declares the rebuild here. The backend applies it in the transaction that applies the pack’s schema plan, after the plan’s statements:

  • when the stored CREATE TABLE of table contains marker, the table already has the new shape: its columns must equal columns, or the plan is refused and nothing is rebuilt again;
  • otherwise script runs, every table in rebuilds must hold exactly the rows it held before, the plan’s statements run again to recreate the triggers and indexes the script dropped, and the stored CREATE TABLE of table must then contain marker.

Any failure rolls the whole transaction back: the store keeps its old shape and the pack does not load. Read-only backends run no replacement. Identifiers use ASCII letters, digits, or underscores and cannot start with a digit.

Fields§

§table: &'static str

The table whose stored CREATE TABLE carries marker. The pack’s schema plan creates it.

§marker: &'static str

Text found in the stored CREATE TABLE of table only once it has the new shape.

§columns: &'static [&'static str]

The column names of table in the new shape, in order.

§rebuilds: &'static [&'static str]

Every table the script drops and recreates, table among them. Each keeps its rows.

§script: &'static str

SQL that rebuilds the tables in rebuilds: create each new table under another name, copy its rows, drop the old table and rename the new one. A dropped table’s triggers and indexes go with it; the plan’s statements recreate them.

Trait Implementations§

Source§

impl Clone for PackTableReplacement

Source§

fn clone(&self) -> Self

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 Copy for PackTableReplacement

Source§

impl Debug for PackTableReplacement

Source§

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

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

impl Eq for PackTableReplacement

Source§

impl PartialEq for PackTableReplacement

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PackTableReplacement

Auto Trait Implementations§

§

impl Forget for PackTableReplacement

§

impl Freeze for PackTableReplacement
where &'static str: Freeze, &'static [&'static str]: Freeze,

§

impl Move for PackTableReplacement

§

impl RefUnwindSafe for PackTableReplacement

§

impl Send for PackTableReplacement
where &'static str: Send, &'static [&'static str]: Send,

§

impl Sync for PackTableReplacement

§

impl Unpin for PackTableReplacement
where &'static str: Unpin, &'static [&'static str]: Unpin,

§

impl UnsafeUnpin for PackTableReplacement
where &'static str: UnsafeUnpin, &'static [&'static str]: UnsafeUnpin,

§

impl UnwindSafe for PackTableReplacement
where &'static str: UnwindSafe, &'static [&'static str]: UnwindSafe,

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> 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.