Sequeliseed is an inverse seed package that allows you to generate seeds from existing data in database tables.
Note: This package currently supports Sequelize ORM only.
$ npm i sequeliseed
Make sure you have already installed Sequelize ORM prior to the installation of this package.
The usage is pretty straightforward. Sequeliseed has its own CLI for running commands.
To generate a single seeder from a single table:
$ sequeliseed generate table_name
To generate multiple seeders from a multiple tables:
$ sequeliseed generate table1_name table2_name table3_name
Add as many as table names seperated by a space.
Specify the environment
You can pass this optional parameter to specify the current environment of your project. The default environment is
$ sequeliseed generate table1_name --env development
Make sure the particular environment is defined in
config.json file in your Sequelize installation.
Manual database configurations
If you have altered the default
config.json file of your Sequelize installation, Sequeliseed won’t be able to read the database configurations.
So, in that case, you have to manually enter database credentials on the CLI.
--config option at the end of the command. And then it’ll prompt for certain database credentials.
$ sequeliseed generate table_name --config
This package currently supports all the database types supported by Sequelize.
This package is open for your suggestions. If you find anything to be added or improved, please fork the repository, build your feature and send a pull request. Or create a new issue if you find something is missing.