From f8c446ce74329fc5844e0fc1fd82e618242196f4 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Thu, 28 Mar 2019 03:33:14 -0500 Subject: migrate and revert executable, query insert and delete test --- src/bin/migrate.rs | 14 ++++++++++++++ src/bin/revert.rs | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/bin/migrate.rs create mode 100644 src/bin/revert.rs (limited to 'src/bin') diff --git a/src/bin/migrate.rs b/src/bin/migrate.rs new file mode 100644 index 0000000..8d269a4 --- /dev/null +++ b/src/bin/migrate.rs @@ -0,0 +1,14 @@ +use diesel::pg::PgConnection; +use diesel::prelude::*; + +use space::math::get_db_url; + +fn main() { + let connection = PgConnection::establish(&get_db_url()).expect("Cannot connect"); + migrations_internals::run_pending_migrations(&connection).expect("Cannot run migrations"); + + //migrations_internals::revert_latest_migration(&connection) + // .expect("Cannot revert migrations"); + //migrations_internals::revert_latest_migration(&connection) + // .expect("Cannot revert migrations"); +} diff --git a/src/bin/revert.rs b/src/bin/revert.rs new file mode 100644 index 0000000..cd26968 --- /dev/null +++ b/src/bin/revert.rs @@ -0,0 +1,10 @@ +use diesel::pg::PgConnection; +use diesel::prelude::*; + +use space::math::get_db_url; + +fn main() { + let connection = PgConnection::establish(&get_db_url()).expect("Cannot connect"); + migrations_internals::revert_latest_migration(&connection).expect("Cannot revert migrations"); + migrations_internals::revert_latest_migration(&connection).expect("Cannot revert migrations"); +} -- cgit v1.2.3