Skip to content

Commit 835fcbe

Browse files
committed
feat(backend,database): change defaults for columns
1 parent b91029e commit 835fcbe

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ryot"
3-
version = "5.5.1"
3+
version = "5.5.2"
44
edition = "2021"
55
repository = "https://github.com/IgnisDa/ryot"
66
license = "GPL-3.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use sea_orm_migration::prelude::*;
2+
3+
#[derive(DeriveMigrationName)]
4+
pub struct Migration;
5+
6+
#[async_trait::async_trait]
7+
impl MigrationTrait for Migration {
8+
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
9+
let db = manager.get_connection();
10+
db.execute_unprepared(
11+
r#"
12+
ALTER TABLE "review" ALTER COLUMN "visibility" SET DEFAULT 'private';
13+
ALTER TABLE "seen" ALTER COLUMN "in_progress" SET DEFAULT 'private';
14+
"#,
15+
)
16+
.await?;
17+
Ok(())
18+
}
19+
20+
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
21+
Ok(())
22+
}
23+
}

libs/database/src/migrations/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ mod m20240601_09_complete_cleanup_of_primary_keys;
4646
mod m20240601_10_change_enums_to_snake_case;
4747
mod m20240601_11_workout_table_changes;
4848
mod m20240606_is_last_v5_migration;
49+
mod m20240607_is_really_last_v5_migration;
4950

5051
pub use m20230410_create_metadata::Metadata as AliasedMetadata;
5152
pub use m20230413_create_person::Person as AliasedPerson;
@@ -126,6 +127,7 @@ impl MigratorTrait for Migrator {
126127
Box::new(m20240601_10_change_enums_to_snake_case::Migration),
127128
Box::new(m20240601_11_workout_table_changes::Migration),
128129
Box::new(m20240606_is_last_v5_migration::Migration),
130+
Box::new(m20240607_is_really_last_v5_migration::Migration),
129131
]
130132
}
131133
}

0 commit comments

Comments
 (0)