diff options
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"); +} |