DROP VIEW vn.absenceType; ALTER TABLE vn.calendar DROP FOREIGN KEY calendar_employee_state_id; RENAME TABLE postgresql.calendar_state TO vn.absenceType; ALTER TABLE vn.absenceType CHANGE calendar_state_id id int(11) auto_increment NOT NULL; ALTER TABLE vn.absenceType CHANGE `type` name varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; ALTER TABLE vn.calendar ADD CONSTRAINT calendar_FK FOREIGN KEY (dayOffTypeFk) REFERENCES vn.absenceType(id) ON DELETE RESTRICT ON UPDATE CASCADE;