feat: multi-module iteration

This commit is contained in:
2026-08-04 21:38:49 +08:00
parent 9d96c73246
commit 71f508e02b
1366 changed files with 202004 additions and 0 deletions
@@ -0,0 +1,36 @@
const { PrismaClient } = require('@prisma/client');
const p = new PrismaClient();
async function ensureColumn(table, column, ddl) {
const cols = await p.$queryRawUnsafe(`SHOW COLUMNS FROM \`${table}\` LIKE '${column}'`);
if (!cols.length) {
await p.$executeRawUnsafe(ddl);
console.log(`added ${table}.${column}`);
} else {
console.log(`${table}.${column} exists`);
}
}
(async () => {
await ensureColumn(
'wecom_bot',
'ai_enabled',
'ALTER TABLE `wecom_bot` ADD COLUMN `ai_enabled` TINYINT(1) NOT NULL DEFAULT 0 AFTER `permissions`',
);
await ensureColumn(
'wecom_bot',
'llm_config_id',
'ALTER TABLE `wecom_bot` ADD COLUMN `llm_config_id` BIGINT UNSIGNED NULL AFTER `ai_enabled`',
);
await ensureColumn(
'wecom_bot',
'knowledge_base_id',
'ALTER TABLE `wecom_bot` ADD COLUMN `knowledge_base_id` BIGINT UNSIGNED NULL AFTER `llm_config_id`',
);
await p.$disconnect();
})().catch(async (e) => {
console.error(e);
await p.$disconnect();
process.exit(1);
});