I have a folder with all my model definitions like this:
(Generated by sequelize-auto)
//items.js
const Sequelize = require('sequelize');
module.exports = function (sequelize, DataTypes) {
return sequelize.define('items', {
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
}
})
}
Would it be possible to require that model instance and then pass that to queryInterface.createTable instead of having to copy the definition.
Something like this
//00_init.js
const DataTypes = require("sequelize").DataTypes;
const sequelize = new Sequelize(conf.db.main_db, null, null, {});
const items = require("./items")(sequelize,DataTypes);
asynx function up({context: queryInterface}){
await await queryInterface.createTable(items)
}
I have a folder with all my model definitions like this:
(Generated by sequelize-auto)
Would it be possible to require that model instance and then pass that to queryInterface.createTable instead of having to copy the definition.
Something like this