fix: cascade obj/activity deletions in addressing
otherwise its impossible to delete objects because foreign key relation is violated!
This commit is contained in:
parent
b3184e7ae2
commit
16a10112a8
3 changed files with 8 additions and 4 deletions
|
@ -19,7 +19,7 @@ pub enum Relation {
|
||||||
from = "Column::Activity",
|
from = "Column::Activity",
|
||||||
to = "super::activity::Column::Internal",
|
to = "super::activity::Column::Internal",
|
||||||
on_update = "Cascade",
|
on_update = "Cascade",
|
||||||
on_delete = "NoAction"
|
on_delete = "Cascade"
|
||||||
)]
|
)]
|
||||||
Activities,
|
Activities,
|
||||||
#[sea_orm(
|
#[sea_orm(
|
||||||
|
@ -27,7 +27,7 @@ pub enum Relation {
|
||||||
from = "Column::Actor",
|
from = "Column::Actor",
|
||||||
to = "super::actor::Column::Internal",
|
to = "super::actor::Column::Internal",
|
||||||
on_update = "Cascade",
|
on_update = "Cascade",
|
||||||
on_delete = "NoAction"
|
on_delete = "Cascade"
|
||||||
)]
|
)]
|
||||||
Actors,
|
Actors,
|
||||||
#[sea_orm(
|
#[sea_orm(
|
||||||
|
@ -43,7 +43,7 @@ pub enum Relation {
|
||||||
from = "Column::Object",
|
from = "Column::Object",
|
||||||
to = "super::object::Column::Internal",
|
to = "super::object::Column::Internal",
|
||||||
on_update = "Cascade",
|
on_update = "Cascade",
|
||||||
on_delete = "NoAction"
|
on_delete = "Cascade"
|
||||||
)]
|
)]
|
||||||
Objects,
|
Objects,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use apb::{field::OptionalString, Link, Collection, Document, Endpoints, Node, Object, PublicKey};
|
use apb::{field::OptionalString, Collection, Document, Endpoints, Node, Object, PublicKey};
|
||||||
use sea_orm::{sea_query::Expr, ActiveModelTrait, ActiveValue::{Unchanged, NotSet, Set}, ColumnTrait, ConnectionTrait, DbErr, EntityTrait, IntoActiveModel, QueryFilter};
|
use sea_orm::{sea_query::Expr, ActiveModelTrait, ActiveValue::{Unchanged, NotSet, Set}, ColumnTrait, ConnectionTrait, DbErr, EntityTrait, IntoActiveModel, QueryFilter};
|
||||||
|
|
||||||
use super::Addresser;
|
use super::Addresser;
|
||||||
|
|
|
@ -50,6 +50,7 @@ impl MigrationTrait for Migration {
|
||||||
.from(Addressing::Table, Addressing::Actor)
|
.from(Addressing::Table, Addressing::Actor)
|
||||||
.to(Actors::Table, Actors::Internal)
|
.to(Actors::Table, Actors::Internal)
|
||||||
.on_update(ForeignKeyAction::Cascade)
|
.on_update(ForeignKeyAction::Cascade)
|
||||||
|
.on_delete(ForeignKeyAction::Cascade)
|
||||||
)
|
)
|
||||||
.col(ColumnDef::new(Addressing::Instance).big_integer().null())
|
.col(ColumnDef::new(Addressing::Instance).big_integer().null())
|
||||||
.foreign_key(
|
.foreign_key(
|
||||||
|
@ -58,6 +59,7 @@ impl MigrationTrait for Migration {
|
||||||
.from(Addressing::Table, Addressing::Instance)
|
.from(Addressing::Table, Addressing::Instance)
|
||||||
.to(Instances::Table, Instances::Internal)
|
.to(Instances::Table, Instances::Internal)
|
||||||
.on_update(ForeignKeyAction::Cascade)
|
.on_update(ForeignKeyAction::Cascade)
|
||||||
|
.on_update(ForeignKeyAction::NoAction)
|
||||||
)
|
)
|
||||||
.col(ColumnDef::new(Addressing::Activity).big_integer().null())
|
.col(ColumnDef::new(Addressing::Activity).big_integer().null())
|
||||||
.foreign_key(
|
.foreign_key(
|
||||||
|
@ -66,6 +68,7 @@ impl MigrationTrait for Migration {
|
||||||
.from(Addressing::Table, Addressing::Activity)
|
.from(Addressing::Table, Addressing::Activity)
|
||||||
.to(Activities::Table, Activities::Internal)
|
.to(Activities::Table, Activities::Internal)
|
||||||
.on_update(ForeignKeyAction::Cascade)
|
.on_update(ForeignKeyAction::Cascade)
|
||||||
|
.on_delete(ForeignKeyAction::Cascade)
|
||||||
)
|
)
|
||||||
.col(ColumnDef::new(Addressing::Object).big_integer().null())
|
.col(ColumnDef::new(Addressing::Object).big_integer().null())
|
||||||
.foreign_key(
|
.foreign_key(
|
||||||
|
@ -74,6 +77,7 @@ impl MigrationTrait for Migration {
|
||||||
.from(Addressing::Table, Addressing::Object)
|
.from(Addressing::Table, Addressing::Object)
|
||||||
.to(Objects::Table, Objects::Internal)
|
.to(Objects::Table, Objects::Internal)
|
||||||
.on_update(ForeignKeyAction::Cascade)
|
.on_update(ForeignKeyAction::Cascade)
|
||||||
|
.on_delete(ForeignKeyAction::Cascade)
|
||||||
)
|
)
|
||||||
.col(ColumnDef::new(Addressing::Published).timestamp_with_time_zone().not_null().default(Expr::current_timestamp()))
|
.col(ColumnDef::new(Addressing::Published).timestamp_with_time_zone().not_null().default(Expr::current_timestamp()))
|
||||||
.to_owned()
|
.to_owned()
|
||||||
|
|
Loading…
Reference in a new issue