MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / create_active_enum_child_table

Function create_active_enum_child_table

tests/common/features/schema.rs:219–251  ·  view source on GitHub ↗
(db: &DbConn)

Source from the content-addressed store, hash-verified

217}
218
219pub async fn create_active_enum_child_table(db: &DbConn) -> Result<ExecResult, DbErr> {
220 let create_table_stmt = sea_query::Table::create()
221 .table(active_enum_child::Entity.table_ref())
222 .col(
223 ColumnDef::new(active_enum_child::Column::Id)
224 .integer()
225 .not_null()
226 .auto_increment()
227 .primary_key(),
228 )
229 .col(
230 ColumnDef::new(active_enum_child::Column::ParentId)
231 .integer()
232 .not_null(),
233 )
234 .col(ColumnDef::new(active_enum_child::Column::Category).string_len(1))
235 .col(ColumnDef::new(active_enum_child::Column::Color).integer())
236 .col(
237 ColumnDef::new(active_enum_child::Column::Tea)
238 .enumeration(TeaEnum, [TeaVariant::EverydayTea, TeaVariant::BreakfastTea]),
239 )
240 .foreign_key(
241 ForeignKeyCreateStatement::new()
242 .name("fk-active_enum_child-active_enum")
243 .from_tbl(ActiveEnumChild)
244 .from_col(active_enum_child::Column::ParentId)
245 .to_tbl(ActiveEnum)
246 .to_col(active_enum::Column::Id),
247 )
248 .to_owned();
249
250 create_table(db, &create_table_stmt, ActiveEnumChild).await
251}
252
253pub async fn create_satellites_table(db: &DbConn) -> Result<ExecResult, DbErr> {
254 let stmt = sea_query::Table::create()

Callers 1

create_tablesFunction · 0.85

Calls 6

table_refMethod · 0.80
createFunction · 0.50
newFunction · 0.50
create_tableFunction · 0.50
auto_incrementMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected