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

Function create_tables

tests/common/features/schema.rs:12–70  ·  view source on GitHub ↗
(db: &DatabaseConnection)

Source from the content-addressed store, hash-verified

10};
11
12pub async fn create_tables(db: &DatabaseConnection) -> Result<(), DbErr> {
13 let db_backend = db.get_database_backend();
14
15 create_log_table(db).await?;
16 create_metadata_table(db).await?;
17 create_repository_table(db).await?;
18 create_self_join_table(db).await?;
19 create_byte_primary_key_table(db).await?;
20 create_satellites_table(db).await?;
21 create_transaction_log_table(db).await?;
22
23 let create_enum_stmts = match db_backend {
24 DbBackend::MySql | DbBackend::Sqlite => Vec::new(),
25 DbBackend::Postgres => {
26 let schema = Schema::new(db_backend);
27 let enum_create_stmt = Type::create()
28 .as_enum("tea")
29 .values(["EverydayTea", "BreakfastTea"])
30 .to_owned();
31 assert_eq!(
32 db_backend.build(&enum_create_stmt),
33 db_backend.build(&schema.create_enum_from_active_enum::<Tea>())
34 );
35 vec![enum_create_stmt]
36 }
37 };
38 create_enum(db, &create_enum_stmts, ActiveEnum).await?;
39
40 create_active_enum_table(db).await?;
41 create_active_enum_child_table(db).await?;
42 create_insert_default_table(db).await?;
43 create_pi_table(db).await?;
44 create_uuid_fmt_table(db).await?;
45 create_edit_log_table(db).await?;
46 create_teas_table(db).await?;
47 create_binary_table(db).await?;
48 if matches!(db_backend, DbBackend::Postgres) {
49 create_bits_table(db).await?;
50 }
51 create_dyn_table_name_lazy_static_table(db).await?;
52 create_value_type_table(db).await?;
53
54 create_json_vec_table(db).await?;
55 create_json_struct_table(db).await?;
56 create_json_string_vec_table(db).await?;
57 create_json_struct_vec_table(db).await?;
58
59 if DbBackend::Postgres == db_backend {
60 create_value_type_postgres_table(db).await?;
61 create_collection_table(db).await?;
62 create_event_trigger_table(db).await?;
63 create_categories_table(db).await?;
64 #[cfg(feature = "postgres-vector")]
65 create_embedding_table(db).await?;
66 create_host_network_table(db).await?;
67 }
68
69 Ok(())

Callers 15

mainFunction · 0.50
partial_model_flatFunction · 0.50
partial_model_nestedFunction · 0.50
partial_model_join_threeFunction · 0.50
exists_with_no_resultFunction · 0.50
exists_with_resultFunction · 0.50

Calls 15

create_log_tableFunction · 0.85
create_metadata_tableFunction · 0.85
create_repository_tableFunction · 0.85
create_self_join_tableFunction · 0.85
create_satellites_tableFunction · 0.85
create_enumFunction · 0.85
create_active_enum_tableFunction · 0.85
create_pi_tableFunction · 0.85

Tested by 15

mainFunction · 0.40
partial_model_flatFunction · 0.40
partial_model_nestedFunction · 0.40
partial_model_join_threeFunction · 0.40
exists_with_no_resultFunction · 0.40
exists_with_resultFunction · 0.40