initial commit
This commit is contained in:
20
packages/server/src/database/index.ts
Normal file
20
packages/server/src/database/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import path from "path";
|
||||
import { Sequelize } from "sequelize";
|
||||
|
||||
export const sequelize = new Sequelize({
|
||||
dialect: "sqlite",
|
||||
storage: path.resolve(__dirname, process.env.DB_PATH || "./data.sqlite"),
|
||||
});
|
||||
|
||||
async function initializeDatabase() {
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
/**
|
||||
* add database table here
|
||||
*/
|
||||
} catch (error) {
|
||||
console.error("connect db error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
initializeDatabase();
|
||||
Reference in New Issue
Block a user