I have a Firebird table like this:
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 IN()
list in the CHECK constraint. How do I do that?
Things I've tried so far:
Updating the value in
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''))';
Does not seem to work, as the trigger is compiled in
RDB$TRIGGERS.RDB$TRIGGER_BLR
.Creating a new table with a new check, copying the data over, dropping the old table and renaming the new table. However, it seems that one cannot rename a Firebird table, so I can't make the new table have the same name as the old one.
I suspect updating RDB$TRIGGERS
is the way to go (idk!), if only I could get Firebird to recompile the code. But maybe there's a better way?