初次提交
This commit is contained in:
26
config/database-init.js
Normal file
26
config/database-init.js
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
const { initDB, } = require('../database');
|
||||
|
||||
/**
|
||||
* 数据库初始化函数
|
||||
* 创建所有必要的表结构和初始数据
|
||||
*/
|
||||
async function initDatabase() {
|
||||
try {
|
||||
|
||||
|
||||
// 初始化数据库连接池
|
||||
await initDB();
|
||||
console.log('数据库连接池初始化成功');
|
||||
} catch (error) {
|
||||
console.error('数据库初始化失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
initDatabase
|
||||
};
|
||||
Reference in New Issue
Block a user