Move getSequelizeModels to sequelize folder
This commit is contained in:
parent
a2d113562e
commit
b9378a2356
|
@ -102,5 +102,5 @@ fastify.listen(fastify.siteConfig.port, function (err, address) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fastify.decorate('canEmail', typeof fastify.nodemailer !== 'undefined');
|
fastify.decorate('canEmail', typeof fastify.nodemailer !== 'undefined');
|
||||||
fastify.decorate('models', require('./getSequelizeModels')(fastify.sequelize));
|
fastify.decorate('models', require('./sequelize/getModels')(fastify.sequelize));
|
||||||
});
|
});
|
|
@ -1,6 +1,6 @@
|
||||||
const Sequelize = require('sequelize');
|
const Sequelize = require('sequelize');
|
||||||
|
|
||||||
function getSequelizeModels (sequelize) {
|
function getModels (sequelize) {
|
||||||
const User = sequelize.define('user', {
|
const User = sequelize.define('user', {
|
||||||
id: {
|
id: {
|
||||||
type: Sequelize.INTEGER,
|
type: Sequelize.INTEGER,
|
||||||
|
@ -360,4 +360,4 @@ function getSequelizeModels (sequelize) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getSequelizeModels;
|
module.exports = getModels;
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Sequelize = require('sequelize');
|
const Sequelize = require('sequelize');
|
||||||
const getSequelizeModels = require('./server/getSequelizeModels');
|
const getModels = require('./server/sequelize/getModels');
|
||||||
const force = typeof process.argv[2] !== 'undefined' && process.argv[2] === 'force';
|
const force = typeof process.argv[2] !== 'undefined' && process.argv[2] === 'force';
|
||||||
let siteConfig;
|
let siteConfig;
|
||||||
try {
|
try {
|
||||||
|
@ -37,7 +37,7 @@ switch (siteConfig.db_engine) {
|
||||||
|
|
||||||
const sequelize = new Sequelize(sequelizeConfig);
|
const sequelize = new Sequelize(sequelizeConfig);
|
||||||
|
|
||||||
const Models = getSequelizeModels(sequelize);
|
const Models = getModels(sequelize);
|
||||||
|
|
||||||
sequelize.sync({ force }).then(() => {
|
sequelize.sync({ force }).then(() => {
|
||||||
const promises = [ // Default status types to use in Statuses
|
const promises = [ // Default status types to use in Statuses
|
||||||
|
|
Loading…
Reference in New Issue