init
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// 데이터베이스 모델 동기화 스크립트
|
||||
const { sequelize, syncModels, testConnection } = require('./src/models');
|
||||
|
||||
async function initializeDatabase() {
|
||||
try {
|
||||
// 데이터베이스 연결 테스트
|
||||
console.log('데이터베이스 연결 테스트 중...');
|
||||
await testConnection();
|
||||
|
||||
// 모델 동기화 (테이블 생성)
|
||||
console.log('데이터베이스 모델 동기화 중...');
|
||||
await syncModels();
|
||||
|
||||
console.log('데이터베이스 초기화가 완료되었습니다.');
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('데이터베이스 초기화 중 오류 발생:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 스크립트 실행
|
||||
initializeDatabase();
|
||||
Reference in New Issue
Block a user