 delete from canano.common_lookup
 where value = 'review article'
 ;
-
-
--- End of script
ALTER TABLE canano.author
CHANGE document_author_pk_id author_pk_id BIGINT(20) not null;

--add data to author.created_by and author.created_date
--larger author.id should has larger author.created_date
UPDATE canano.author author
SET author.created_by = 'DATA_MIGRATION',
author.created_date = ADDDATE(SYSDATE(), INTERVAL author.author_pk_id SECOND)
order by author.author_pk_id;

-- change to not null
ALTER TABLE canano.author
 CHANGE created_date created_date DATETIME NOT NULL;
 

ADD CONSTRAINT FK_author_publication_author FOREIGN KEY (author_pk_id) REFERENCES canano.author (author_pk_id) ON UPDATE RESTRICT ON DELETE RESTRICT,
ADD CONSTRAINT FK_author_publication_publication FOREIGN KEY (publication_pk_id) REFERENCES canano.publication (publication_pk_id) ON UPDATE RESTRICT ON DELETE RESTRICT;

update canano.functionalizing_entity fe, canano.activation_method am
set fe.activation_method_pk_id = null
where am.activation_method_pk_id = fe.activation_method_pk_id
