I have a Firebird table as follows:
CREATE TABLE events (
event VARCHAR(6) NOT NULL
CHECK (event IN ('deploy', 'revert', 'fail')),
change_id CHAR(40) NOT NULL,
change VARCHAR(512) NOT NULL
);
Now I need to add another value to the list IN()in the CHECK constraint. How to do it?
Things I've tried so far:
Update value to RDB$TRIGGERS.RDB$TRIGGER_SOURCE:
UPDATE RDB$TRIGGERS
SET RDB$TRIGGER_SOURCE = 'CHECK (event IN (''deploy'', ''revert'', ''fail'', ''merge''))'
WHERE RDB$TRIGGER_SOURCE = 'CHECK (event IN (''deploy'', ''revert'', ''fail''))';
It doesn't seem to work as the trigger is compiled into RDB$TRIGGERS.RDB$TRIGGER_BLR.
Create a new table with a new check, copy data, delete the old table and rename the new table. However, it seems that it cannot rename the Firebird table , so I cannot force the new table to have the same name as the old one.
I suspect that updating RDB$TRIGGERSis the way to go (idk!), If only I can get Firebird to recompile the code. But maybe there is a better way?