salix/db/versions/.archive/10665-maroonSalal/00-firstScript.sql

20 lines
825 B
MySQL
Raw Permalink Normal View History

ALTER TABLE vn.business DROP FOREIGN KEY business_workerBusinessAgreementFk;
CREATE TABLE `vn`.`workerBusinessAgreement` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`monthHolidays` double DEFAULT NULL,
`yearHours` int(11) DEFAULT NULL,
`started` date DEFAULT NULL,
`ended` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
INSERT INTO vn.workerBusinessAgreement
SELECT labour_agreement_id, name, month_hollidays, year_hours, date_START, date_END
FROM postgresql.labour_agreement__;
ALTER TABLE vn.business ADD CONSTRAINT business_workerBusinessAgreementFk FOREIGN KEY (workerBusinessAgreementFk) REFERENCES vn.workerBusinessAgreement(id) ON DELETE RESTRICT ON UPDATE CASCADE;
DROP TABLE postgresql.labour_agreement__;