✓ Uses Rust 2018 edition
|new 0.1.7||Feb 13, 2019|
|0.1.6||Feb 9, 2019|
|0.1.4||Jan 23, 2019|
#18 in #postgres
30 downloads per month
You MUST set a
PSQL_URL environment variable to your libellis postgres database.
$ export PSQL_URL=postgres://username:password@localhost/
Note the ending forward slash in the example above is required. You can optionally set this in a
.env file in the root folder of this project if you are
running the project from a local folder.
You may install this in one of two ways. If you have
cargo installed then it's very easy. If
not, you can install rust and cargo by following this very simple cargo setup process.
Once you have cargo installed you can install this terminal application by running:
$ cargo install birdseed
Optionally you may instead clone this repo and in the root directory build the release version of this crate:
$ git clone https://github.com/libellis/birdseed.git $ cd birdseed $ cargo build --release
You can seed all databases with the
$ birdseed feed
We can specify a row count (overriding the default of 1000 rows):
$ birdseed feed -r 10000
In this exampe we override the default of 1,000 rows and instead seed 10,000 rows.
Note: What the row count really means is that we will seed row count amount of users, surveys and questions, but row count * 4 amount of choices and votes.
You can setup the main libellis and libellis_test databases with this subcommand. It will attempt to drop both libellis and libellis_test before creating them so be careful! Only use this if you don't need the data in your libellis database and want to start over, or are creating your libellis databases for the first time.
$ birdseed setup
To run migrations, use the migrate subcommand (this will update your database schema to the most recent schema).
$ birdseed migrate
By default this runs migrations on all databases. To run migrations on only main run:
$ birdseed migrate -d main
To run migrations only on the test database run:
$ birdseed migrate -d test
You can rebuild all tables according to embedded diesel migrations. This drops each table (but does not drop the database itself) and then rebuilds all tables. Note that you must already have
libellis_test databases for this to work. If you do not have those databases run
birdseed setup instead.
$ birdseed rebuild
rebuild by default will rebuild all tables in both your main and test
databases. If you would like to specify to only rebuild one database, pass in
'main' or 'test' to the -database argument flag:
$ birdseed rebuild -database main
You can also use
-d for shorthand:
$ birdseed rebuild -d test
You can clear all tables with the
$ birdseed clear