javascript Sequelize:.sequelizerc

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Sequelize:.sequelizerc相关的知识,希望对你有一定的参考价值。

const path = require('path');
const fs = require('fs');
const config = require(`${process.cwd()}/config`);
const env = process.env.NODE_ENV.toLowerCase();

// Preprocess the config file
const sequelizeConfig = {
	[env]: config.postgresql,
};

// Write this to the temp folder
const configFilePath = process.cwd() + "/.temp/sequelizeConfig.js";
fs.writeFileSync(configFilePath, `module.exports = ${JSON.stringify(sequelizeConfig)}`);

module.exports = {
	'config': path.resolve(configFilePath),
	'models-path': path.resolve('server', 'models'),
	'seeders-path': path.resolve('seeders'),
	'migrations-path': path.resolve('migrations')
}

以上是关于javascript Sequelize:.sequelizerc的主要内容,如果未能解决你的问题,请参考以下文章

javascript Sequelize嵌套包含

javascript Sequelize嵌套包含

javascript Sequelize Model

javascript Sequelize:.sequelizerc

javascript Sequelize:模型大纲

javascript Sequelize:var基本模型设置