ormlette/schema/create
Types
pub type Column {
Column(
name: String,
type_: ColumnType,
is_primary: Bool,
is_nullable: Bool,
is_unique: Bool,
default: Option(dynamic.Dynamic),
references: Option(Reference),
)
}
Constructors
-
Column( name: String, type_: ColumnType, is_primary: Bool, is_nullable: Bool, is_unique: Bool, default: Option(dynamic.Dynamic), references: Option(Reference), )
pub type ColumnType {
Int
String
Bool
ForeignKey
Serial
}
Constructors
-
Int
-
String
-
Bool
-
ForeignKey
-
Serial
pub type Reference {
Reference(
table: Table,
column: String,
on_delete: Option(String),
on_update: Option(String),
)
}
Constructors
-
Reference( table: Table, column: String, on_delete: Option(String), on_update: Option(String), )
Functions
pub fn dbtype_to_string(dbtype: ColumnType) -> String
pub fn define_table(name: String, columns: List(Column)) -> Table
pub fn foreign_key(
col: Column,
references_table: Table,
references_column: String,
) -> Column
pub fn format_column_sql(column: Column) -> String