Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ impl MigrationTrait for Migration {
.string()
.not_null(),
)
.col(
ColumnDef::new(encryption_network::Column::OwnerDid)
.string()
.not_null(),
)
.col(ColumnDef::new(Alias::new("principal")).string().not_null())
.col(
ColumnDef::new(encryption_network::Column::Name)
.string()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use sea_orm_migration::prelude::*;

use crate::models::encryption_network;

#[derive(DeriveMigrationName)]
pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(encryption_network::Entity)
.rename_column(
Alias::new("principal"),
encryption_network::Column::OwnerDid,
)
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(encryption_network::Entity)
.rename_column(
encryption_network::Column::OwnerDid,
Alias::new("principal"),
)
.to_owned(),
)
.await
}
}
2 changes: 2 additions & 0 deletions tinycloud-core/src/migrations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod m20260409_000000_hook_tables;
pub mod m20260512_000000_signed_kv_tickets;
pub mod m20260516_000000_database_artifacts;
pub mod m20260601_000000_encryption_networks;
pub mod m20260602_000000_rename_encryption_owner_did;

pub struct Migrator;

Expand All @@ -18,6 +19,7 @@ impl MigratorTrait for Migrator {
Box::new(m20260512_000000_signed_kv_tickets::Migration),
Box::new(m20260516_000000_database_artifacts::Migration),
Box::new(m20260601_000000_encryption_networks::Migration),
Box::new(m20260602_000000_rename_encryption_owner_did::Migration),
]
}
}
1 change: 0 additions & 1 deletion tinycloud-core/src/models/encryption_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key, auto_increment = false, unique)]
pub network_id: String,
#[sea_orm(column_name = "principal")]
pub owner_did: String,
pub name: String,
pub alg: String,
Expand Down
Loading