Read/write css file from app settings. Changed order of operations at app startup. Added nano to Dockerfile

This commit is contained in:
unknown
2021-06-22 13:07:32 +02:00
parent 4c3255107c
commit 5ae4d6e7c4
15 changed files with 161 additions and 35 deletions

15
db.js
View File

@@ -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
};
}