Skip to content

Commit

Permalink
feat(backend,database): change defaults for columns
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Jun 1, 2024
1 parent b91029e commit 835fcbe
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ryot"
version = "5.5.1"
version = "5.5.2"
edition = "2021"
repository = "https://github.com/IgnisDa/ryot"
license = "GPL-3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use sea_orm_migration::prelude::*;

#[derive(DeriveMigrationName)]
pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let db = manager.get_connection();
db.execute_unprepared(
r#"
ALTER TABLE "review" ALTER COLUMN "visibility" SET DEFAULT 'private';
ALTER TABLE "seen" ALTER COLUMN "in_progress" SET DEFAULT 'private';
"#,
)
.await?;
Ok(())
}

async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
Ok(())
}
}
2 changes: 2 additions & 0 deletions libs/database/src/migrations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mod m20240601_09_complete_cleanup_of_primary_keys;
mod m20240601_10_change_enums_to_snake_case;
mod m20240601_11_workout_table_changes;
mod m20240606_is_last_v5_migration;
mod m20240607_is_really_last_v5_migration;

pub use m20230410_create_metadata::Metadata as AliasedMetadata;
pub use m20230413_create_person::Person as AliasedPerson;
Expand Down Expand Up @@ -126,6 +127,7 @@ impl MigratorTrait for Migrator {
Box::new(m20240601_10_change_enums_to_snake_case::Migration),
Box::new(m20240601_11_workout_table_changes::Migration),
Box::new(m20240606_is_last_v5_migration::Migration),
Box::new(m20240607_is_really_last_v5_migration::Migration),
]
}
}

0 comments on commit 835fcbe

Please sign in to comment.