BEGIN;

alter table messaging_output add column name varchar(32);
update messaging_output set name = '' where name IS NULL;
alter table messaging_output alter column name set not null;
alter table messaging_output alter column name set default '';

alter table messaging_output add column description varchar(256);
update messaging_output set description = '' where description IS NULL;
alter table messaging_output alter column description set not null;
alter table messaging_output alter column description set default '';

alter table messaging_output add column state varchar(32);
update messaging_output set state = 'off' where state IS NULL;
alter table messaging_output alter column state set not null;
alter table messaging_output alter column state set default 'off';

alter table messaging_output add constraint messaging_output_state_check CHECK (state IN ('on', 'off'));

COMMIT;
