mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-06 20:43:13 +08:00
Read/write css file from app settings. Changed order of operations at app startup. Added nano to Dockerfile
This commit is contained in:
15
db.js
15
db.js
@@ -4,21 +4,26 @@ const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: './data/db.sqlite',
|
||||
logging: false
|
||||
});
|
||||
})
|
||||
|
||||
const connectDB = async () => {
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
console.log('Connected to database');
|
||||
|
||||
await sequelize.sync({ alter: true });
|
||||
console.log('All models were synced');
|
||||
const syncModels = true;
|
||||
|
||||
if (syncModels) {
|
||||
console.log('Starting model synchronization');
|
||||
await sequelize.sync({ alter: true });
|
||||
console.log('All models were synchronized');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Unable to connect to the database:', error);
|
||||
throw new Error(`Unable to connect to the database: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
connectDB,
|
||||
sequelize
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user