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

Function create_byte_primary_key_table

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

Source from the content-addressed store, hash-verified

176}
177
178pub async fn create_byte_primary_key_table(db: &DbConn) -> Result<ExecResult, DbErr> {
179 let mut primary_key_col = ColumnDef::new(byte_primary_key::Column::Id);
180 match db.get_database_backend() {
181 DbBackend::MySql => primary_key_col.binary_len(3),
182 DbBackend::Sqlite | DbBackend::Postgres => primary_key_col.binary(),
183 };
184
185 let stmt = sea_query::Table::create()
186 .table(byte_primary_key::Entity)
187 .col(primary_key_col.not_null().primary_key())
188 .col(
189 ColumnDef::new(byte_primary_key::Column::Value)
190 .string()
191 .not_null(),
192 )
193 .to_owned();
194
195 create_table_without_asserts(db, &stmt).await
196}
197
198pub async fn create_active_enum_table(db: &DbConn) -> Result<ExecResult, DbErr> {
199 let create_table_stmt = sea_query::Table::create()

Callers 1

create_tablesFunction · 0.85

Calls 4

newFunction · 0.50
createFunction · 0.50
get_database_backendMethod · 0.45

Tested by

no test coverage detected