pub struct TableDef {
pub name: String,
pub struct_name: String,
pub columns: Vec<ColumnDef>,
pub relations: Vec<RelationDef>,
pub composite_uniques: Vec<Vec<String>>,
pub composite_indexes: Vec<Vec<String>>,
}Fields§
§name: StringSQL table name (products).
struct_name: StringRust struct name (Product).
columns: Vec<ColumnDef>§relations: Vec<RelationDef>Prisma-style relation fields: struct fields that are not database
columns but hold a related row (Option<OtherTable>), populated by an
eager join when a query asks for them via include:. Skipped by the
migration diff entirely — they carry no DDL.
composite_uniques: Vec<Vec<String>>#[orm(unique(col_a, col_b))] on the struct — a composite UNIQUE
constraint, each entry an ordered column-name list. Rendered as a
CREATE UNIQUE INDEX, not an inline table constraint, so it can be
added/dropped without a full table rebuild (same as a plain index).
composite_indexes: Vec<Vec<String>>#[orm(index(col_a, col_b))] on the struct — a multi-column index, or
a single-column index on a column that’s part of a composite primary
key (where field-level #[orm(index)] is rejected as redundant with
the PK’s own index, even though a secondary single-column index there
is often genuinely useful — SQLite’s PK index is ordered and doesn’t
help a lookup on a non-leading PK column alone).