pub struct TableModel {
pub schema: String,
pub name: String,
pub rename_from: Option<String>,
pub comment: Option<String>,
pub columns: Vec<ColumnModel>,
pub primary_key: Option<PrimaryKeyModel>,
pub unique_constraints: Vec<UniqueConstraintModel>,
pub foreign_keys: Vec<ForeignKeyModel>,
pub indexes: Vec<IndexModel>,
}Expand description
单张表的期望/实际结构。
Fields§
§schema: String所属 schema 名称,例如 auth、flow、finance、public
name: String表名
rename_from: Option<String>当前表名由旧名改名而来时填写旧表名,用于生成 RENAME 迁移。 重命名不允许按名称相似度猜测,必须显式声明。
comment: Option<String>COMMENT ON TABLE 的内容;None 表示不设置注释。
columns: Vec<ColumnModel>字段列表(按创建顺序)
primary_key: Option<PrimaryKeyModel>主键约束(单列或联合主键)
unique_constraints: Vec<UniqueConstraintModel>唯一约束(表级;单字段唯一约束也会归一化到这里)
foreign_keys: Vec<ForeignKeyModel>外键约束
indexes: Vec<IndexModel>普通索引(不含主键/唯一约束背书的索引)
Implementations§
Trait Implementations§
Source§impl Clone for TableModel
impl Clone for TableModel
Source§fn clone(&self) -> TableModel
fn clone(&self) -> TableModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TableModel
impl Debug for TableModel
Source§impl Default for TableModel
impl Default for TableModel
Source§fn default() -> TableModel
fn default() -> TableModel
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TableModel
impl<'de> Deserialize<'de> for TableModel
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TableModel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TableModel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TableModel
Source§impl PartialEq for TableModel
impl PartialEq for TableModel
Source§impl Serialize for TableModel
impl Serialize for TableModel
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for TableModel
Auto Trait Implementations§
impl Freeze for TableModel
impl RefUnwindSafe for TableModel
impl Send for TableModel
impl Sync for TableModel
impl Unpin for TableModel
impl UnsafeUnpin for TableModel
impl UnwindSafe for TableModel
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