feat(db): add auth schema migrations (10 tables)
- users with partial unique index on (tenant_id, username) WHERE deleted_at IS NULL - user_credentials, user_tokens with FK cascade - roles, permissions with composite unique (tenant_id, code) - role_permissions, user_roles junction tables - organizations (self-ref tree), departments (tree + org FK), positions - All tables include standard fields: id, tenant_id, timestamps, soft delete, version
This commit is contained in:
@@ -1,12 +1,34 @@
|
||||
pub use sea_orm_migration::prelude::*;
|
||||
|
||||
mod m20260410_000001_create_tenant;
|
||||
mod m20260411_000002_create_users;
|
||||
mod m20260411_000003_create_user_credentials;
|
||||
mod m20260411_000004_create_user_tokens;
|
||||
mod m20260411_000005_create_roles;
|
||||
mod m20260411_000006_create_permissions;
|
||||
mod m20260411_000007_create_role_permissions;
|
||||
mod m20260411_000008_create_user_roles;
|
||||
mod m20260411_000009_create_organizations;
|
||||
mod m20260411_000010_create_departments;
|
||||
mod m20260411_000011_create_positions;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigratorTrait for Migrator {
|
||||
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
||||
vec![Box::new(m20260410_000001_create_tenant::Migration)]
|
||||
vec![
|
||||
Box::new(m20260410_000001_create_tenant::Migration),
|
||||
Box::new(m20260411_000002_create_users::Migration),
|
||||
Box::new(m20260411_000003_create_user_credentials::Migration),
|
||||
Box::new(m20260411_000004_create_user_tokens::Migration),
|
||||
Box::new(m20260411_000005_create_roles::Migration),
|
||||
Box::new(m20260411_000006_create_permissions::Migration),
|
||||
Box::new(m20260411_000007_create_role_permissions::Migration),
|
||||
Box::new(m20260411_000008_create_user_roles::Migration),
|
||||
Box::new(m20260411_000009_create_organizations::Migration),
|
||||
Box::new(m20260411_000010_create_departments::Migration),
|
||||
Box::new(m20260411_000011_create_positions::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user