27 lines
931 B
TypeScript
27 lines
931 B
TypeScript
import db from '../src/database/models/index.js';
|
|
|
|
async function testInsert() {
|
|
try {
|
|
// Attempt insert without checking existing records
|
|
// If it fails with "invalid input value", the enum is truly not updated.
|
|
// If it fails with "foreign key", the enum was VALID but the data was wrong.
|
|
await db.sequelize.query(`
|
|
DO $$
|
|
BEGIN
|
|
-- This will fail if 'architecture' is invalid for the enum
|
|
PERFORM 'architecture'::"enum_request_participants_participantType";
|
|
RAISE NOTICE '✅ Enum check passed!';
|
|
EXCEPTION WHEN OTHERS THEN
|
|
RAISE EXCEPTION '❌ Enum check failed: %', SQLERRM;
|
|
END $$;
|
|
`);
|
|
console.log('✅ PL/pgSQL Enum check passed!');
|
|
} catch (error: any) {
|
|
console.error(error.message);
|
|
} finally {
|
|
process.exit(0);
|
|
}
|
|
}
|
|
|
|
testInsert();
|