--- channel-thread-events

EXEC sp_RENAME 'channel_events' , 'channel_thread_events';

declare @constraint varchar(100)
SELECT @constraint = KCU.CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU ON KCU.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
WHERE KCU.TABLE_NAME = 'channel_thread_events' AND KCU.COLUMN_NAME = 'channel_id'
EXEC('alter table channel_thread_events drop  CONSTRAINT ' + @constraint);

DROP INDEX channel_events_channel_id_id_desc_ix on channel_thread_events
ALTER TABLE channel_thread_events
  DROP COLUMN channel_id;

