[][src]Crate birdseed

This crate's entire purpose is to seed the libellis database with fake data (generated by faker library).

Setup

You MUST set your DATABASE_URL environment variable to your libellis postgres database.

Example

$ export DATABASE_URL=postgres://username:password@localhost/libellis

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.

Installation

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

Features

feed

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.

clear

You can clear all tables with the clear subcommand:

$ birdseed clear

rebuild

You can rebuild all tables according to embedded diesel migrations

$ birdseed rebuild

Enums

Birdseed

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

Functions

run

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)