fix: Create the index after the table
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
530f3bc90b
commit
4e50cb34c0
3 changed files with 38 additions and 37 deletions
|
@ -29,18 +29,6 @@ pub struct Migration;
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl MigrationTrait for Migration {
|
impl MigrationTrait for Migration {
|
||||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
manager
|
|
||||||
.create_index(
|
|
||||||
Index::create()
|
|
||||||
.if_not_exists()
|
|
||||||
.name("sep_request")
|
|
||||||
.table(InChatRequests::Table)
|
|
||||||
.col(InChatRequests::RecipientId)
|
|
||||||
.col(InChatRequests::Sender)
|
|
||||||
.unique()
|
|
||||||
.to_owned(),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
manager
|
manager
|
||||||
.create_table(
|
.create_table(
|
||||||
Table::create()
|
Table::create()
|
||||||
|
@ -74,6 +62,18 @@ impl MigrationTrait for Migration {
|
||||||
)
|
)
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.if_not_exists()
|
||||||
|
.name("sep_request")
|
||||||
|
.table(InChatRequests::Table)
|
||||||
|
.col(InChatRequests::RecipientId)
|
||||||
|
.col(InChatRequests::Sender)
|
||||||
|
.unique()
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,19 +29,6 @@ pub struct Migration;
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl MigrationTrait for Migration {
|
impl MigrationTrait for Migration {
|
||||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
manager
|
|
||||||
.create_index(
|
|
||||||
Index::create()
|
|
||||||
.if_not_exists()
|
|
||||||
.name("sep_request")
|
|
||||||
.table(OutChatRequests::Table)
|
|
||||||
.col(OutChatRequests::SenderId)
|
|
||||||
.col(OutChatRequests::Recipient)
|
|
||||||
.unique()
|
|
||||||
.to_owned(),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.create_table(
|
.create_table(
|
||||||
Table::create()
|
Table::create()
|
||||||
|
@ -79,6 +66,19 @@ impl MigrationTrait for Migration {
|
||||||
)
|
)
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.if_not_exists()
|
||||||
|
.name("sep_request")
|
||||||
|
.table(OutChatRequests::Table)
|
||||||
|
.col(OutChatRequests::SenderId)
|
||||||
|
.col(OutChatRequests::Recipient)
|
||||||
|
.unique()
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,18 +40,6 @@ impl MigrationTrait for Migration {
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
manager
|
|
||||||
.create_index(
|
|
||||||
Index::create()
|
|
||||||
.if_not_exists()
|
|
||||||
.name("sep_status")
|
|
||||||
.table(UsersStatus::Table)
|
|
||||||
.col(UsersStatus::UserId)
|
|
||||||
.col(UsersStatus::Target)
|
|
||||||
.unique()
|
|
||||||
.to_owned(),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.create_table(
|
.create_table(
|
||||||
|
@ -90,6 +78,19 @@ impl MigrationTrait for Migration {
|
||||||
)
|
)
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.if_not_exists()
|
||||||
|
.name("sep_status")
|
||||||
|
.table(UsersStatus::Table)
|
||||||
|
.col(UsersStatus::UserId)
|
||||||
|
.col(UsersStatus::Target)
|
||||||
|
.unique()
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue