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

Function create_baker_table

tests/common/bakery_chain/schema.rs:38–66  ·  view source on GitHub ↗
(db: &DbConn)

Source from the content-addressed store, hash-verified

36}
37
38pub async fn create_baker_table(db: &DbConn) -> Result<ExecResult, DbErr> {
39 let stmt = Table::create()
40 .table(baker::Entity)
41 .col(
42 ColumnDef::new(baker::Column::Id)
43 .integer()
44 .not_null()
45 .auto_increment()
46 .primary_key(),
47 )
48 .col(ColumnDef::new(baker::Column::Name).string().not_null())
49 .col(
50 ColumnDef::new(baker::Column::ContactDetails)
51 .json()
52 .not_null(),
53 )
54 .col(ColumnDef::new(baker::Column::BakeryId).integer())
55 .foreign_key(
56 ForeignKey::create()
57 .name("fk-baker-bakery_id")
58 .from(baker::Entity, baker::Column::BakeryId)
59 .to(bakery::Entity, bakery::Column::Id)
60 .on_delete(ForeignKeyAction::SetNull)
61 .on_update(ForeignKeyAction::Cascade),
62 )
63 .to_owned();
64
65 create_table(db, &stmt, Baker).await
66}
67
68pub async fn create_customer_table(db: &DbConn) -> Result<ExecResult, DbErr> {
69 let stmt = Table::create()

Callers 1

create_tablesFunction · 0.85

Calls 9

on_updateMethod · 0.80
on_deleteMethod · 0.80
createFunction · 0.50
newFunction · 0.50
create_tableFunction · 0.50
auto_incrementMethod · 0.45
toMethod · 0.45
fromMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected