quanyoumi/backend/migrations/0001-add-danmaku-fields.js

25 lines
603 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 迁移: 添加弹幕功能字段
* 版本: 0001
* 日期: 2025-01-09
*/
module.exports = {
async up(manager) {
console.log(' - 添加 danmakuEnabled 字段...');
await manager.executeSql(`
ALTER TABLE Activities ADD COLUMN danmakuEnabled INTEGER DEFAULT 0;
`);
console.log(' - 添加 danmakuContent 字段...');
await manager.executeSql(`
ALTER TABLE Activities ADD COLUMN danmakuContent TEXT;
`);
},
async down(manager) {
// SQLite 不支持 DROP COLUMN需要重建表
console.log(' - 回滚不支持,请手动处理');
}
};