Skip to content

Commit

Permalink
update sequelize config (#856)
Browse files Browse the repository at this point in the history
* update sequelize config

Change sequelize so it stores memory of which migrations and seeders have run in custom named tables

* update package json command
  • Loading branch information
FancMa01 authored Sep 5, 2024
1 parent 06d30b1 commit 9c42ec0
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions Tombolo/server/config/config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
const path = require('path');
const fs = require('fs');
const rootENV = path.join(process.cwd(), '..', '.env');
const serverENV = path.join(process.cwd(), '.env');
const path = require("path");
const fs = require("fs");
const rootENV = path.join(process.cwd(), "..", ".env");
const serverENV = path.join(process.cwd(), ".env");
const ENVPath = fs.existsSync(rootENV) ? rootENV : serverENV;
require('dotenv').config({ path: ENVPath});
require("dotenv").config({ path: ENVPath });

const logger = require('./logger');
const logger = require("./logger");
const dbConfigOptions = {
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOSTNAME,
dialect: 'mysql',
seederStorage: 'json',
logging: (msg) => logger.debug(msg), // change winston settings to 'debug' to see this log
}
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOSTNAME,
dialect: "mysql",
seederStorage: "sequelize",
seederStorageTableName: "sequelize_seeders",
migrationStorageTableName: "sequelize_migrations",

logging: (msg) => logger.debug(msg), // change winston settings to 'debug' to see this log
};

if(process.env.MYSQL_SSL_ENABLED === "true"){
dbConfigOptions.ssl = true;
dbConfigOptions.dialectOptions = {
ssl: {
require: true
}
}
if (process.env.MYSQL_SSL_ENABLED === "true") {
dbConfigOptions.ssl = true;
dbConfigOptions.dialectOptions = {
ssl: {
require: true,
},
};
}

module.exports = {
development: dbConfigOptions,
production: dbConfigOptions
production: dbConfigOptions,
};

0 comments on commit 9c42ec0

Please sign in to comment.