refactor: enforce unique constraints on account and account_category names; update foreign key actions
This commit is contained in:
@@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i64,
|
||||
#[sea_orm(unique)]
|
||||
pub name: String,
|
||||
pub account_category_id: i64,
|
||||
pub created_at: String,
|
||||
@@ -21,7 +22,7 @@ pub enum Relation {
|
||||
belongs_to = "super::account_category::Entity",
|
||||
from = "Column::AccountCategoryId",
|
||||
to = "super::account_category::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_update = "Restrict",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
AccountCategory,
|
||||
|
||||
@@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i64,
|
||||
#[sea_orm(unique)]
|
||||
pub name: String,
|
||||
pub account_type: String,
|
||||
pub created_at: String,
|
||||
|
||||
Reference in New Issue
Block a user