(db: &DbConn)
| 152 | } |
| 153 | |
| 154 | pub async fn create_self_join_table(db: &DbConn) -> Result<ExecResult, DbErr> { |
| 155 | let stmt = sea_query::Table::create() |
| 156 | .table(self_join::Entity) |
| 157 | .col( |
| 158 | ColumnDef::new(self_join::Column::Uuid) |
| 159 | .uuid() |
| 160 | .not_null() |
| 161 | .primary_key(), |
| 162 | ) |
| 163 | .col(ColumnDef::new(self_join::Column::UuidRef).uuid()) |
| 164 | .col(ColumnDef::new(self_join::Column::Time).time()) |
| 165 | .foreign_key( |
| 166 | ForeignKeyCreateStatement::new() |
| 167 | .name("fk-self_join-uuid_ref") |
| 168 | .from_tbl(SelfJoin) |
| 169 | .from_col(self_join::Column::UuidRef) |
| 170 | .to_tbl(SelfJoin) |
| 171 | .to_col(self_join::Column::Uuid), |
| 172 | ) |
| 173 | .to_owned(); |
| 174 | |
| 175 | create_table(db, &stmt, SelfJoin).await |
| 176 | } |
| 177 | |
| 178 | pub 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); |
no test coverage detected