const Sequelize = require('sequelize'); const config = { dialect: 'mysql', host: '127.0.0.1', port: 3307, database: 'wms', username: 'wms', password: 'dspxmRwRdRbWtbm7', logging: false }; const sequelize = new Sequelize(config.database, config.username, config.password, config); async function run() { try { const results = {}; const [dyxdCountResult] = await sequelize.query("SELECT COUNT(*) as count FROM wms_platform WHERE code='DYXD'"); results.dyxdCount = dyxdCountResult[0].count; const [dyCountResult] = await sequelize.query("SELECT COUNT(*) as count FROM wms_platform WHERE code='DY'"); results.dyCount = dyCountResult[0].count; const [dyRowResult] = await sequelize.query("SELECT * FROM wms_platform WHERE code='DY' LIMIT 1"); results.dyRow = dyRowResult[0] || null; // The user asked for "metaExists (SequelizeMeta 是否存在该 migration 记录)" // Based on previous terminal logs, the migration file name or pattern seems to be related to "platform_code" or "wms_platform" const [metaResult] = await sequelize.query("SELECT * FROM SequelizeMeta"); const migrationName = '20250303080004-platform_code.js'; // This is an assumption based on common naming. // Let's search for any record that contains 'platform' in the name. const exists = metaResult.some(m => m.name.includes('platform')); results.metaExists = exists; try { const [expressTotalResult] = await sequelize.query("SELECT COUNT(*) as count FROM wms_express"); results.expressTotal = expressTotalResult[0].count; } catch (e) {} console.log(JSON.stringify(results, null, 2)); } catch (error) { console.error(error); } finally { await sequelize.close(); } } run();