refactor: demo.db migration structure
Some checks failed
/ integration-test--firefox (push) Failing after 3m7s
Some checks failed
/ integration-test--firefox (push) Failing after 3m7s
This commit is contained in:
parent
1f05189ec6
commit
cd4096b2ff
9 changed files with 26 additions and 46 deletions
12
src/db.rs
12
src/db.rs
|
|
@ -23,12 +23,14 @@ impl Database {
|
|||
|
||||
let pool = SqlitePoolOptions::new().connect_with(db_options).await?;
|
||||
|
||||
let migrator = if user.username == "demo" {
|
||||
sqlx::migrate!("./migrations/demo.db/")
|
||||
} else {
|
||||
sqlx::migrate!("./migrations/each_user/")
|
||||
sqlx::migrate!("./migrations/each_user/")
|
||||
.run(&pool)
|
||||
.await?;
|
||||
if user.username == "demo" {
|
||||
sqlx::query_file!("./migrations/demo.sql")
|
||||
.execute(&pool)
|
||||
.await?;
|
||||
};
|
||||
migrator.run(&pool).await?;
|
||||
|
||||
Ok(Self { pool })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue