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

Function setup_schema

tests/basic.rs:26–46  ·  view source on GitHub ↗
(db: &DbConn)

Source from the content-addressed store, hash-verified

24
25#[cfg(feature = "sqlx-sqlite")]
26async fn setup_schema(db: &DbConn) -> Result<(), DbErr> {
27 use sea_query::*;
28
29 let stmt = sea_query::Table::create()
30 .table(cake::Entity)
31 .col(
32 ColumnDef::new(cake::Column::Id)
33 .integer()
34 .not_null()
35 .auto_increment()
36 .primary_key(),
37 )
38 .col(ColumnDef::new(cake::Column::Name).string())
39 .to_owned();
40
41 let builder = db.get_database_backend();
42 let result = db.execute(builder.build(&stmt)).await?;
43 println!("Create table cake: {result:?}");
44
45 Ok(())
46}
47
48#[cfg(feature = "sqlx-sqlite")]
49async fn crud_cake(db: &DbConn) -> Result<(), DbErr> {

Callers 1

mainFunction · 0.85

Calls 6

createFunction · 0.50
newFunction · 0.50
auto_incrementMethod · 0.45
get_database_backendMethod · 0.45
executeMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected