CLI / db
The db command group provides database management tools powered by Sequel migrations. It allows you to create, drop, and migrate your database across development, test, and production environments.
bin/roda db create
Creates the database configured in your application settings.
* SQLite: Creates the SQLite database file and necessary parent directories.
* PostgreSQL / MySQL: Executes native database creation utilities using connection info parsed from Config.get[:db][:url].
$ bin/roda db create
bin/roda db drop
Drops the application database.
* SQLite: Deletes the target .sqlite3 database file if it exists.
* PostgreSQL / MySQL: Executes native database drop commands.
$ bin/roda db drop
bin/roda db migrate
Runs Sequel schema migrations located in db/migrations/.
$ bin/roda db migrate [OPTIONS]
Options
-t,--target=N: Specifies a target migration version number (e.g.1or003) to migrate up or down to a specific schema version.
Examples
Migrate to the latest version:
$ bin/roda db migrate
Migrate to target version 1:
$ bin/roda db migrate -t 1
Migrate test environment database:
$ RACK_ENV=test bin/roda db migrate