From e4199239396494236e9cbbfb6154111d8934c022 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 23 Nov 2023 03:35:40 +0100 Subject: [PATCH] Move migrations around --- .env | 1 + emgauwa-lib/build.rs | 2 +- emgauwa-lib/src/db/mod.rs | 2 +- .../migrations => migrations}/20231120000000_init.down.sql | 0 .../migrations => migrations}/20231120000000_init.up.sql | 0 5 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .env rename {emgauwa-lib/migrations => migrations}/20231120000000_init.down.sql (100%) rename {emgauwa-lib/migrations => migrations}/20231120000000_init.up.sql (100%) diff --git a/.env b/.env new file mode 100644 index 0000000..2f5ee4c --- /dev/null +++ b/.env @@ -0,0 +1 @@ +DATABASE_URL="sqlite://emgauwa-dev.sqlite" diff --git a/emgauwa-lib/build.rs b/emgauwa-lib/build.rs index e9edec5..65d8d11 100644 --- a/emgauwa-lib/build.rs +++ b/emgauwa-lib/build.rs @@ -1,4 +1,4 @@ fn main() { println!("cargo:rerun-if-changed=migrations"); - println!("cargo:rustc-env=DATABASE_URL=sqlite://emgauwa-dev.sqlite") + println!("cargo:rustc-env=DATABASE_URL=sqlite://emgauwa-dev.sqlite"); } diff --git a/emgauwa-lib/src/db/mod.rs b/emgauwa-lib/src/db/mod.rs index 649664c..efef1fa 100644 --- a/emgauwa-lib/src/db/mod.rs +++ b/emgauwa-lib/src/db/mod.rs @@ -16,7 +16,7 @@ pub(crate) mod schedules; pub(crate) mod tag; pub mod types; -static MIGRATOR: Migrator = sqlx::migrate!(); // defaults to "./migrations" +static MIGRATOR: Migrator = sqlx::migrate!("../migrations"); // defaults to "./migrations" pub async fn run_migrations(pool: &Pool) { info!("Running migrations"); diff --git a/emgauwa-lib/migrations/20231120000000_init.down.sql b/migrations/20231120000000_init.down.sql similarity index 100% rename from emgauwa-lib/migrations/20231120000000_init.down.sql rename to migrations/20231120000000_init.down.sql diff --git a/emgauwa-lib/migrations/20231120000000_init.up.sql b/migrations/20231120000000_init.up.sql similarity index 100% rename from emgauwa-lib/migrations/20231120000000_init.up.sql rename to migrations/20231120000000_init.up.sql