Skip to content

Commit b853fc3

Browse files
committed
🗃️ feat(migration): casbin_rule data migration first creates the table structure
1 parent 12f3a53 commit b853fc3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

migration/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ path = "src/lib.rs"
1414

1515
[dependencies]
1616
async-std = { version = "1", features = ["attributes", "tokio1"] }
17+
sea-orm-adapter = { path = "../sea-orm-adapter" }
1718

1819
[dependencies.sea-orm-migration]
1920
version = "1.0.0"
2021
features = [
2122
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
2223
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
2324
# e.g.
24-
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
25-
"sqlx-postgres", # `DATABASE_DRIVER` feature
25+
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
26+
"sqlx-postgres", # `DATABASE_DRIVER` feature
2627
]

migration/src/datas/m20241024_082926_insert_casbin_rule.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ impl MigrationTrait for Migration {
88
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
99
let db = manager.get_connection();
1010

11+
// 执行架构迁移
12+
sea_orm_adapter::up(db).await?;
13+
1114
let insert_casbin_rules_stmt = Statement::from_string(
1215
manager.get_database_backend(),
1316
r#"

0 commit comments

Comments
 (0)