This crate's entire purpose is to seed the libellis database with fake data (generated by faker library).
You MUST set a PSQL_URL environment variable to your libellis postgres database.
terminal
$ 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:
terminal
$ cargo install birdseed
Optionally you may instead clone this repo and in the root directory build the release version of this crate:
terminal
$ git clone https://github.com/libellis/birdseed.git
$ cd birdseed
$ cargo build --release
feedYou can seed all databases with the feed subcommand:
terminal
$ birdseed feed
We can specify a row count (overriding the default of 1000 rows):
terminal
$ 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.
setupYou can setup the main libellis and libellistest databases with this subcommand. It will attempt to drop both libellis and libellistest 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.
terminal
$ birdseed setup
migrateTo run migrations, use the migrate subcommand (this will update your database schema to the most recent schema).
terminal
$ birdseed migrate
By default this runs migrations on all databases. To run migrations on only main run:
terminal
$ birdseed migrate -d main
To run migrations only on the test database run:
terminal
$ birdseed migrate -d test
clearYou can clear all tables with the clear subcommand:
terminal
$ birdseed clear
rebuildYou can rebuild all tables according to embedded diesel migrations
terminal
$ birdseed rebuild