diff options
author | tom barrett <spalf0@gmail.com> | 2019-03-28 03:33:14 -0500 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2019-03-28 07:24:51 -0500 |
commit | f8c446ce74329fc5844e0fc1fd82e618242196f4 (patch) | |
tree | 02319b823da4888c6d4e2faa9f482be11caad353 /src/bin | |
parent | ca5ee0b32b616fb8fa5e7e44c74acecefab719c3 (diff) |
migrate and revert executable, query insert and delete test
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/migrate.rs | 14 | ||||
-rw-r--r-- | src/bin/revert.rs | 10 |
2 files changed, 24 insertions, 0 deletions
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"); +} |