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

Function create_lineitem_table

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

Source from the content-addressed store, hash-verified

128}
129
130pub async fn create_lineitem_table(db: &DbConn) -> Result<ExecResult, DbErr> {
131 let stmt = Table::create()
132 .table(lineitem::Entity)
133 .col(
134 ColumnDef::new(lineitem::Column::Id)
135 .integer()
136 .not_null()
137 .auto_increment()
138 .primary_key(),
139 )
140 .col(
141 ColumnDef::new(lineitem::Column::Price)
142 .decimal_len(16, 4)
143 .not_null(),
144 )
145 .col(
146 ColumnDef::new(lineitem::Column::Quantity)
147 .integer()
148 .not_null(),
149 )
150 .col(
151 ColumnDef::new(lineitem::Column::OrderId)
152 .integer()
153 .not_null(),
154 )
155 .col(
156 ColumnDef::new(lineitem::Column::CakeId)
157 .integer()
158 .not_null(),
159 )
160 .foreign_key(
161 ForeignKey::create()
162 .name("fk-lineitem-order_id")
163 .from(lineitem::Entity, lineitem::Column::OrderId)
164 .to(order::Entity, order::Column::Id)
165 .on_delete(ForeignKeyAction::Cascade)
166 .on_update(ForeignKeyAction::Cascade),
167 )
168 .foreign_key(
169 ForeignKey::create()
170 .name("fk-lineitem-cake_id")
171 .from(lineitem::Entity, lineitem::Column::CakeId)
172 .to(cake::Entity, cake::Column::Id),
173 )
174 .to_owned();
175
176 create_table(db, &stmt, Lineitem).await
177}
178
179pub async fn create_cakes_bakers_table(db: &DbConn) -> Result<ExecResult, DbErr> {
180 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