Add missing jira_tickets sync columns migration and improve error messages
- Add add_jira_sync_columns_pg.js migration (jira_id, jira_status, last_synced_at, created_by) - Register in run-all.js before the flexible creation migration - Replace all generic 'Internal server error' with actual err.message in jiraTickets routes - Users and admins can now see the real failure reason instead of a useless generic message
This commit is contained in:
@@ -28,6 +28,23 @@ async function run() {
|
||||
await pool.query(`ALTER TABLE jira_tickets ALTER COLUMN vendor DROP NOT NULL`);
|
||||
console.log('✓ vendor NOT NULL constraint dropped (or was already nullable)');
|
||||
|
||||
// Add jira_id, jira_status, last_synced_at, created_by columns
|
||||
// (originally from SQLite migration add_jira_sync_columns.js — never ported to Postgres run-all)
|
||||
await pool.query(`ALTER TABLE jira_tickets ADD COLUMN IF NOT EXISTS jira_id TEXT`);
|
||||
console.log('✓ jira_id column added (or already exists)');
|
||||
|
||||
await pool.query(`ALTER TABLE jira_tickets ADD COLUMN IF NOT EXISTS jira_status TEXT`);
|
||||
console.log('✓ jira_status column added (or already exists)');
|
||||
|
||||
await pool.query(`ALTER TABLE jira_tickets ADD COLUMN IF NOT EXISTS last_synced_at TIMESTAMPTZ`);
|
||||
console.log('✓ last_synced_at column added (or already exists)');
|
||||
|
||||
await pool.query(`ALTER TABLE jira_tickets ADD COLUMN IF NOT EXISTS created_by INTEGER`);
|
||||
console.log('✓ created_by column added (or already exists)');
|
||||
|
||||
await pool.query(`CREATE INDEX IF NOT EXISTS idx_jira_tickets_jira_id ON jira_tickets(jira_id)`);
|
||||
console.log('✓ jira_id index created (or already exists)');
|
||||
|
||||
// Add source_context column with default value (IF NOT EXISTS makes it idempotent)
|
||||
await pool.query(`
|
||||
ALTER TABLE jira_tickets
|
||||
|
||||
Reference in New Issue
Block a user