Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions rfd-installer/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

fn main() {
println!("cargo:rerun-if-changed=../rfd-model/migrations");
}
10 changes: 2 additions & 8 deletions rfd-installer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use diesel::{
migration::{Migration, MigrationSource},
pg::Pg,
r2d2::{ConnectionManager, ManageConnection},
PgConnection,
};
use diesel_migrations::{embed_migrations, EmbeddedMigrations};
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};

const MIGRATIONS: EmbeddedMigrations = embed_migrations!("../rfd-model/migrations");

Expand All @@ -17,11 +15,7 @@ pub fn run_migrations(url: &str, v_only: bool) {

if !v_only {
let mut conn = db_conn(url);
let migrations: Vec<Box<dyn Migration<Pg>>> = MIGRATIONS.migrations().unwrap();

for migration in migrations {
migration.run(&mut conn).unwrap();
}
conn.run_pending_migrations(MIGRATIONS).unwrap();
}
}

Expand Down
Loading