ALTER TABLE DYNDNS ADD IP varchar2(15) NULL;
ALTER TABLE DYNDNS ADD CREATED_DATE TIMESTAMP NULL;

ALTER TABLE DYNDNS ADD DELETED NUMBER DEFAULT 0 NOT NULL;
ALTER TABLE DYNDNS ADD DELETED_DATE TIMESTAMP NULL;
ALTER TABLE DYNDNS DROP CONSTRAINT DYNDNS_HA_ID_UNIQUE;
DROP INDEX DYNDNS_HA_ID_UNIQUE;
ALTER TABLE DYNDNS ADD CONSTRAINT DYNDNS_HA_ID_DELETED_UNIQUE UNIQUE (HA_ID, DELETED);

UPDATE DYNDNS SET deleted=1 WHERE ENABLED=0 AND DOMAIN_NAME IS NULL;
COMMIT;
