https://github.com/michaelmior/mysql-faker
https://github.com/michaelmior/mysql-faker
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/michaelmior/mysql-faker
- Owner: michaelmior
- Created: 2015-01-12T15:38:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-24T17:03:37.000Z (over 7 years ago)
- Last Synced: 2025-03-28T15:48:11.963Z (about 1 month ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MySQL Faker
This module uses the excellent [faker.js](https://github.com/Marak/faker.js/) to easily generate data to populate MySQL database with fake data.
For now, the module assumes that all tables already exist.
To start, create an instance of the `Table` class giving a name and the number of entities to generate.
Faker types can then be chained on this class to add columns to the database.
All types are functions on the `Table` class with an underscore character between the type category and name.
For example, `faker.name.firstName()` is equivalent to `table.name_firstName`.
The first parameter to the type is the name of the column and any additional parameters are passed on to `faker`.## Example
```
var mysql_faker = require('mysql-faker');var users = (new mysql_faker.Table('users', 1000000));
users.name_firstName('firstname')
.name_lastName('lastname')mysql_faker.insert([users]);
```