Automatically generate data and fill your database tables with test data.
filldb-pg will try to guess the format of data required based on column names and will generate random names, dates, emails, addresses and more to fill your PostgreSQL database with data.
const {Pool} = require("pg");
const fillDB = require('./index');
const pool = new Pool();
const usersTable = `CREATE TABLE IF NOT EXISTS
users
(
id SERIAL PRIMARY KEY,
email VARCHAR NOT NULL UNIQUE,
first_name VARCHAR(128) NOT NULL,
last_name VARCHAR(128) NOT NULL
)`;
fillDB.fillFake(pool, usersTable, 5);
pool.end();
As result
id | first_name | last_name | |
---|---|---|---|
1 | [email protected] | Arvilla | Yost |
2 | [email protected] | Willard | Kunze |
3 | [email protected] | Guadalupe | Dare |
4 | [email protected] | Cynthia | Hahn |
5 | [email protected] | Adelia | Buckridge |