17 lines
486 B
JavaScript
17 lines
486 B
JavaScript
|
|
const sequelize = require('./db');
|
||
|
|
const { Region, Apartment, Room, Tenant, Contract, Rental } = require('../models');
|
||
|
|
|
||
|
|
// 同步数据库表结构
|
||
|
|
const syncDatabase = async () => {
|
||
|
|
try {
|
||
|
|
console.log('正在同步数据库表结构...');
|
||
|
|
await sequelize.sync({ force: true });
|
||
|
|
console.log('数据库表结构同步成功');
|
||
|
|
} catch (error) {
|
||
|
|
console.error('数据库表结构同步失败:', error);
|
||
|
|
} finally {
|
||
|
|
await sequelize.close();
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
syncDatabase();
|