modify:新增小程序

This commit is contained in:
ECRZ
2026-01-06 18:00:43 +08:00
parent 498fa0e915
commit da4a055c1c
47 changed files with 7321 additions and 61 deletions

View File

@@ -0,0 +1,35 @@
require('dotenv').config();
const Price = require('../src/models/Price');
/**
* 数据库迁移脚本:添加数据源标识字段
* 为现有 prices 表添加数据源区分字段
*/
async function migrate() {
console.log('🔄 开始数据库迁移:添加数据源标识字段\n');
try {
await Price.migrateAddSourceFields();
console.log('\n' + '='.repeat(60));
console.log('✅ 数据库迁移完成!');
console.log('='.repeat(60));
console.log('\n📊 新增字段说明:');
console.log(' - price_source_code: 数据源代码YUNNAN_STEEL_ASSOC / MY_STEEL / DE_STEEL_FACTORY');
console.log(' - price_source_desc: 数据源描述');
console.log(' - data_origin: 数据来源标识LOCAL_FILE 或 API:ENDPOINT');
console.log('\n🎨 数据源标识:');
console.log(' 🔴 YUNNAN_STEEL_ASSOC - 云南钢协指导价DEFAULT 接口)');
console.log(' 🔵 MY_STEEL - 我的钢铁网价格BACKUP 接口)');
console.log(' 🟢 DE_STEEL_FACTORY - 德钢钢厂指导价EXTENDED 接口)');
process.exit(0);
} catch (error) {
console.error('\n❌ 迁移失败:', error);
process.exit(1);
}
}
// 运行迁移
migrate();