pub struct TableSchema {
pub name: String,
pub columns: Vec<ColumnSchema>,
pub indexes: Vec<IndexSchema>,
pub foreign_keys: Vec<ForeignKeySchema>,
pub primary_key: Vec<String>,
pub migration_id: Option<String>,
}Expand description
Represents a complete database table schema
Fields§
§name: StringTable name in the database
columns: Vec<ColumnSchema>Columns in the table
indexes: Vec<IndexSchema>Indexes on the table (excluding primary key)
foreign_keys: Vec<ForeignKeySchema>Foreign key constraints
primary_key: Vec<String>Primary key columns (supports composite keys)
migration_id: Option<String>Migration ID this schema belongs to (for tracking)
Implementations§
Source§impl TableSchema
impl TableSchema
Sourcepub fn add_column(&mut self, column: ColumnSchema)
pub fn add_column(&mut self, column: ColumnSchema)
Add a column to the schema
Sourcepub fn find_column(&self, name: &str) -> Option<&ColumnSchema>
pub fn find_column(&self, name: &str) -> Option<&ColumnSchema>
Find a column by name
Sourcepub fn find_column_mut(&mut self, name: &str) -> Option<&mut ColumnSchema>
pub fn find_column_mut(&mut self, name: &str) -> Option<&mut ColumnSchema>
Find a column by name (mutable)
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TableSchema
impl Debug for TableSchema
Source§impl<'de> Deserialize<'de> for TableSchema
impl<'de> Deserialize<'de> for TableSchema
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for TableSchema
impl PartialEq for TableSchema
Source§impl Serialize for TableSchema
impl Serialize for TableSchema
impl Eq for TableSchema
impl StructuralPartialEq for TableSchema
Auto Trait Implementations§
impl Freeze for TableSchema
impl RefUnwindSafe for TableSchema
impl Send for TableSchema
impl Sync for TableSchema
impl Unpin for TableSchema
impl UnwindSafe for TableSchema
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