@twentyfourg-developer-sdk/model-data-generator
v1.0.8
Published
[![Version](https://flat.badgen.net/npm/v/@twentyfourg-developer-sdk/model-data-generator)](https://github.com/twentyfourg/developer-sdk/releases) [![Installs](https://flat.badgen.net/npm/dt/@twentyfourg-developer-sdk/model-data-generator)](https://www.np
Downloads
7
Readme
@twentyfourg-developer-sdk/model-data-generator
A script that parses a model file, reads data types required, applies constraints listed, creates dummy data, and injects that data into the database and or a fixture file.
Usage
npx @twentyfourg-developer-sdk/model-data-generator
Prompts for:
What models to populate
How many objects to create for each model
Dry run option
- If chosen, data will will not be inserted into the db, but rather printed to the console
Create a fixture file option
Ignores:
- Fields with keys of:
- defaultValue
- primaryKey
Supports:
Constraints:
- allowNull
- unique
- Types:
- 'string', 'char'
- supports length constraint (integer)
- 'text'
- supports length constraint (string)
- 'integer' types
- 'float', 'double', 'decimal'
- 'string', 'char'
- Types:
References to other tables
Field Names:
- 'firstname'
- 'lastname'
- 'name'
- 'fullname'
- 'message'
- 'description'
- 'timezone'
- 'addressOne'
- 'city'
- 'state'
- 'country'
- 'zip'
- 'phone'
- name.includes:
- 'email'
- 'link'
Data Types:
- 'string'
- Constraints:
- Length (integer)
- Constraints:
- 'char'
- Constraints:
- Length (integer)
- Constraints:
- 'text':
- Constraints:
- Length (string)
- Constraints:
- 'boolean':
- Format of 0 or 1
- 'integer':
- min: -2147483648
- max: 2147483647
- 'bigint':
- min: -9223372036854775808
- max: 9223372036854775807
- 'mediumint':
- min: -8388608
- max: 8388608
- 'smallint':
- min: -32768
- max: 32767
- 'tinyint':
- min: -128
- max: 127
- 'float'
- 'double'
- 'decimal'
- 'real'
- 'now'
- 'string'
Contributing
Testing
npm test
Credits
https://github.com/jakowenko https://github.com/roselandroche