pub struct Table {
pub schema: Cow<'static, str>,
pub name: Cow<'static, str>,
pub is_unlogged: Option<bool>,
pub is_temporary: Option<bool>,
pub inherits: Option<Cow<'static, str>>,
pub tablespace: Option<Cow<'static, str>>,
pub is_rls_enabled: Option<bool>,
pub comment: Option<Cow<'static, str>>,
}Expand description
A table, as stored in migration snapshots.
The flags are Option<bool> to match the snapshot format; None means
unset.
Fields§
§schema: Cow<'static, str>Schema name
name: Cow<'static, str>Table name
is_unlogged: Option<bool>Create as an UNLOGGED table?
is_temporary: Option<bool>Create as a TEMPORARY table?
inherits: Option<Cow<'static, str>>Parent table for INHERITS clause.
tablespace: Option<Cow<'static, str>>Tablespace for the table.
is_rls_enabled: Option<bool>Is Row-Level Security enabled?
comment: Option<Cow<'static, str>>Table comment emitted through COMMENT ON TABLE.
Implementations§
Source§impl Table
impl Table
Sourcepub fn drop_table_sql(&self) -> String
pub fn drop_table_sql(&self) -> String
Renders DROP TABLE ...;.
Sourcepub fn rename_table_sql(&self, new_name: &str) -> String
pub fn rename_table_sql(&self, new_name: &str) -> String
Renders ALTER TABLE ... RENAME TO new_name;.
Source§impl Table
impl Table
Sourcepub fn new(
schema: impl Into<Cow<'static, str>>,
name: impl Into<Cow<'static, str>>,
) -> Self
pub fn new( schema: impl Into<Cow<'static, str>>, name: impl Into<Cow<'static, str>>, ) -> Self
Creates a plain table in schema.
Sourcepub fn inherits(self, parent: impl Into<Cow<'static, str>>) -> Self
pub fn inherits(self, parent: impl Into<Cow<'static, str>>) -> Self
Sets the INHERITS parent table.
Sourcepub fn tablespace(self, tablespace: impl Into<Cow<'static, str>>) -> Self
pub fn tablespace(self, tablespace: impl Into<Cow<'static, str>>) -> Self
Sets the TABLESPACE.
Sourcepub const fn rls_enabled(self) -> Self
pub const fn rls_enabled(self) -> Self
Enables row-level security.
Trait Implementations§
impl Eq for Table
impl StructuralPartialEq for Table
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
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
Mutably borrows from an owned value. Read more