tududi/backend/config/database.js
Chris 3c1209a5a9
Express migration (#80)
* Initial migration

* Cleanup and create migration scripts

* Introduce test suite

* Fix test issues

* Correct CORS issue and update paths

* Update README
2025-06-16 21:50:44 +03:00

42 lines
No EOL
954 B
JavaScript

require('dotenv').config();
const path = require('path');
const dbPath = process.env.DATABASE_URL
? process.env.DATABASE_URL.replace('sqlite:///', '')
: path.join(__dirname, '..', 'db');
module.exports = {
development: {
dialect: 'sqlite',
storage: path.join(dbPath, 'development.sqlite3'),
logging: console.log,
define: {
timestamps: true,
underscored: true,
createdAt: 'created_at',
updatedAt: 'updated_at'
}
},
test: {
dialect: 'sqlite',
storage: path.join(dbPath, 'test.sqlite3'),
logging: false,
define: {
timestamps: true,
underscored: true,
createdAt: 'created_at',
updatedAt: 'updated_at'
}
},
production: {
dialect: 'sqlite',
storage: path.join(dbPath, 'production.sqlite3'),
logging: false,
define: {
timestamps: true,
underscored: true,
createdAt: 'created_at',
updatedAt: 'updated_at'
}
}
};