feat: Chat request implementation #14
2 changed files with 18 additions and 8 deletions
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
|
use crate::create_users_table::Users;
|
||||||
|
|
||||||
#[derive(DeriveMigrationName)]
|
#[derive(DeriveMigrationName)]
|
||||||
pub struct Migration;
|
pub struct Migration;
|
||||||
|
|
||||||
|
@ -39,10 +41,13 @@ impl MigrationTrait for Migration {
|
||||||
.auto_increment()
|
.auto_increment()
|
||||||
.primary_key(),
|
.primary_key(),
|
||||||
)
|
)
|
||||||
.col(
|
.foreign_key(
|
||||||
ColumnDef::new(InChatRequests::RecipientId)
|
ForeignKey::create()
|
||||||
.big_integer()
|
.name("fk-in_chat_requests-users")
|
||||||
.not_null(),
|
.from(InChatRequests::Table, InChatRequests::RecipientId)
|
||||||
|
.to(Users::Table, Users::Id)
|
||||||
|
.on_update(ForeignKeyAction::NoAction)
|
||||||
|
.on_delete(ForeignKeyAction::Cascade),
|
||||||
)
|
)
|
||||||
.col(ColumnDef::new(InChatRequests::Sender).string().not_null())
|
.col(ColumnDef::new(InChatRequests::Sender).string().not_null())
|
||||||
.col(
|
.col(
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
|
use crate::create_users_table::Users;
|
||||||
|
|
||||||
#[derive(DeriveMigrationName)]
|
#[derive(DeriveMigrationName)]
|
||||||
pub struct Migration;
|
pub struct Migration;
|
||||||
|
|
||||||
|
@ -39,10 +41,13 @@ impl MigrationTrait for Migration {
|
||||||
.auto_increment()
|
.auto_increment()
|
||||||
.primary_key(),
|
.primary_key(),
|
||||||
)
|
)
|
||||||
.col(
|
.foreign_key(
|
||||||
ColumnDef::new(OutChatRequests::SenderId)
|
ForeignKey::create()
|
||||||
.big_integer()
|
.name("fk-out_chat_requests-users")
|
||||||
.not_null(),
|
.from(OutChatRequests::Table, OutChatRequests::SenderId)
|
||||||
|
.to(Users::Table, Users::Id)
|
||||||
|
.on_update(ForeignKeyAction::NoAction)
|
||||||
|
.on_delete(ForeignKeyAction::Cascade),
|
||||||
)
|
)
|
||||||
.col(
|
.col(
|
||||||
ColumnDef::new(OutChatRequests::Recipient)
|
ColumnDef::new(OutChatRequests::Recipient)
|
||||||
|
|
Loading…
Reference in a new issue