floriday/models/index.js

43 lines
1.5 KiB
JavaScript
Raw Normal View History

import { Sequelize } from "sequelize";
let sequelize = new Sequelize("edi", "root", "root", {
2023-01-09 09:06:34 +00:00
host: "localhost",
dialect: "mariadb",
logging: false,
});
import additionalPricePerPiece from "./additionalPricePerPiece.js";
import botanicalNames from "./botanicalNames.js";
import countryOfOriginIsoCodes from "./countryOfOriginIsoCodes.js";
import packageModel from "./package.js";
import packagingConfigurations from "./packagingConfigurations.js";
import photos from "./photos.js";
import seasonalPeriod from "./seasonalPeriod.js";
import tradeItem from "./tradeItem.js";
import clientConfig from "./clientConfig.js";
import characteristics from "./characteristics.js";
let models = {
additionalPricePerPiece: additionalPricePerPiece(sequelize),
botanicalNames: botanicalNames(sequelize),
countryOfOriginIsoCodes: countryOfOriginIsoCodes(sequelize),
package: packageModel(sequelize),
packagingConfigurations: packagingConfigurations(sequelize),
photos: photos(sequelize),
seasonalPeriod: seasonalPeriod(sequelize),
tradeItem: tradeItem(sequelize),
clientConfig: clientConfig(sequelize),
characteristics: characteristics(sequelize),
};
2023-01-09 09:06:34 +00:00
// Force sync the models if the enviroment variable "FORCE_SYNC" is set to true
if (process.env.FORCE_SYNC === "true") {
console.log("Syncing the models...");
await sequelize.sync({ force: true });
}
import * as insertApiKeys from "./insertApiKeys.js";
await insertApiKeys.default(models);
export default models;