[][src]Crate birdseed

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.


$ export PSQL_URL=postgres://username:password@localhost/

Note the ending forward slash which is necessary. 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 feed subcommand:

$ 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


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 and 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


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 clear all tables with the clear subcommand:

$ birdseed clear



Db Connection request guard type: wrapper around r2d2 pooled connection



DEFINED ERRORS You can use birdseed to seed a libellis db with junk data!



run will take in a Birdseed enum config (parsed in main) and either clear all tables or populate all tables with number of rows specified in -r (1000 by default)

Type Definitions