diff --git a/backend/server.js b/backend/server.js index 36d5164..b86ecd4 100644 --- a/backend/server.js +++ b/backend/server.js @@ -96,18 +96,10 @@ async function syncBusinessModels() { const DeviceBusiness = require('./models/DeviceBusiness'); const Warehouse = require('./models/Warehouse'); - // 仅在开发环境使用 sync({ alter: true }),生产环境应使用 migrations - if (process.env.NODE_ENV !== 'production') { - await Business.sync({ alter: true }); - await DeviceBusiness.sync({ alter: true }); - await Warehouse.sync({ alter: true }); - logger.info('业务/设备关联/库房模型同步完成(alter mode)'); - } else { - await Business.sync(); - await DeviceBusiness.sync(); - await Warehouse.sync(); - logger.info('业务/设备关联/库房模型同步完成(safe mode)'); - } + await Business.sync(); + await DeviceBusiness.sync(); + await Warehouse.sync(); + logger.info('业务/设备关联/库房模型同步完成'); } async function initDefaultSystemSettings() {