Skip to content

Commit ed94f35

Browse files
committed
Rename tables
1 parent 7c14f37 commit ed94f35

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

migration/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod m20180905_090102_populate_activities;
99
mod m20180921_110336_add_admins;
1010
mod m20180922_104727_add_superadmins;
1111
mod m20250828_224244_add_destiny_rising_uids;
12+
mod m20250910_152923_rename_tables;
1213
mod tables;
1314

1415
pub use tables::*;
@@ -31,6 +32,7 @@ impl MigratorTrait for Migrator {
3132
Box::new(m20180921_110336_add_admins::Migration),
3233
Box::new(m20180922_104727_add_superadmins::Migration),
3334
Box::new(m20250828_224244_add_destiny_rising_uids::Migration),
35+
Box::new(m20250910_152923_rename_tables::Migration),
3436
]
3537
}
3638
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
manager
10+
.rename_table(
11+
Table::rename()
12+
.table(
13+
Alias::new("activityshortcuts"),
14+
Alias::new("activity_shortcuts"),
15+
)
16+
.to_owned(),
17+
)
18+
.await?;
19+
20+
manager
21+
.rename_table(
22+
Table::rename()
23+
.table(
24+
Alias::new("plannedactivities"),
25+
Alias::new("planned_activities"),
26+
)
27+
.to_owned(),
28+
)
29+
.await?;
30+
31+
manager
32+
.rename_table(
33+
Table::rename()
34+
.table(
35+
Alias::new("plannedactivitymembers"),
36+
Alias::new("planned_activity_members"),
37+
)
38+
.to_owned(),
39+
)
40+
.await
41+
}
42+
43+
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
44+
manager
45+
.rename_table(
46+
Table::rename()
47+
.table(
48+
Alias::new("activity_shortcuts"),
49+
Alias::new("activityshortcuts"),
50+
)
51+
.to_owned(),
52+
)
53+
.await?;
54+
55+
manager
56+
.rename_table(
57+
Table::rename()
58+
.table(
59+
Alias::new("planned_activities"),
60+
Alias::new("plannedactivities"),
61+
)
62+
.to_owned(),
63+
)
64+
.await?;
65+
66+
manager
67+
.rename_table(
68+
Table::rename()
69+
.table(
70+
Alias::new("planned_activity_members"),
71+
Alias::new("plannedactivitymembers"),
72+
)
73+
.to_owned(),
74+
)
75+
.await
76+
}
77+
}

0 commit comments

Comments
 (0)