Files
api-debug/server/update_endpoints_table.js
jason 96bdc292bb Initial commit: API Debug Tool
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 04:32:35 +08:00

21 lines
708 B
JavaScript

const { pool } = require('./db');
async function migrate() {
try {
console.log('Checking endpoints table for query_params column...');
const [columns] = await pool.query(`SHOW COLUMNS FROM endpoints LIKE 'query_params'`);
if (columns.length === 0) {
console.log('Adding query_params column...');
await pool.query(`ALTER TABLE endpoints ADD COLUMN query_params JSON`);
console.log('query_params column added successfully.');
} else {
console.log('query_params column already exists.');
}
} catch (err) {
console.error('Migration failed:', err);
} finally {
process.exit();
}
}
migrate();