Gina is a tool to auto-generate and run migrations based on Sequelize ORM.
npm install gina-sequelizeGina is a tool to auto-generate and run migrations based on Sequelize ORM.
You can install this using:
``bash`
npm install gina-sequelize
You'll need to install it globally so you can you the gina-cli
`bash`
npm install -g gina-sequelizemake sure to install ts-node too:
npm install -g ts-node
If this is the first time you are running Gina on your project you'll need to initialize it.
`bash`
gina-cli init
This will generate a folder gina to your project.initializeModels.ts
Inside this folder you will find the file .initializeModels
You will need to modify this file so that the method inside it return a valid sequelize instance object that has all your models ALREADY loaded.
Once you have the initializeModels configured you can upgrade your database using:
`bash`
gina-cli upgrade
Once you have the initializeModels configured you can generate auto migrations.gina/migrations
It'll compare your loaded models with the database that you are connected.
All differences should be listed on a new migration file that will be placed inside the folder .
`bash`
gina-cli generate-migration "Creating user table"
If you want to edit the cli and test it you can install it locally:
`bash``
npm install -g .