generated from alecodes/base-template
refactor!: change migration tool to sqlx
This commit is contained in:
parent
27037a9f75
commit
49c8682164
15 changed files with 30 additions and 894 deletions
|
|
@ -31,6 +31,9 @@ pub enum Error {
|
|||
#[error(transparent)]
|
||||
DatabaseOperation(#[from] sqlx::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
Migration(#[from] sqlx::migrate::MigrateError),
|
||||
|
||||
#[error(transparent)]
|
||||
Config(#[from] figment::Error),
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ async fn main() -> Result<()> {
|
|||
.connect(&config.db.generate_db_string(false)?)
|
||||
.await?;
|
||||
|
||||
sqlx::migrate!("./migrations").run(&pool).await?;
|
||||
|
||||
let (tx_state, tx_layer) = Tx::setup(pool);
|
||||
|
||||
let app = router::new()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue