Skip to content

Commit

Permalink
Update database configuration in .env.example and refactor Database i…
Browse files Browse the repository at this point in the history
…nitialization to support JAWSDB_URL
  • Loading branch information
austenstone committed Nov 27, 2024
1 parent 9a8c2c3 commit d08a169
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
8 changes: 1 addition & 7 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,7 @@ const e = express();
const app = new App(
e,
port,
new Database({
dialect: 'mysql',
logging: (sql) => logger.debug(sql),
timezone: '+00:00', // Force UTC timezone
dialectOptions: {
timezone: '+00:00' // Force UTC for MySQL connection
},
new Database(process.env.JAWSDB_URL ? process.env.JAWSDB_URL : {
host: process.env.MYSQL_HOST,
port: Number(process.env.MYSQL_PORT) || 3306,
username: process.env.MYSQL_USER,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Database {
sequelize?: Sequelize;
options: Options = {
dialect: 'mysql',
logging: (...sql) => logger.debug(sql),
logging: (sql) => logger.debug(sql),
timezone: '+00:00', // Force UTC timezone
dialectOptions: {
timezone: '+00:00' // Force UTC for MySQL connection
}
},
}
input: string | Options;

Expand Down
3 changes: 1 addition & 2 deletions backend/src/services/copilot.seats.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class SeatsService {
attributes: [[Sequelize.fn('MAX', Sequelize.col('queryAt')), 'queryAt']],
where: {
...(org ? { org } : {}),
},
raw: true
}
});

return Seat.findAll({
Expand Down

0 comments on commit d08a169

Please sign in to comment.