salix/db/versions/.archive/10645-purplePalmetto/02-updateWagonPrimaryKey.sql

20 lines
1.3 KiB
SQL

ALTER TABLE vn.wagonVolumetry DROP FOREIGN KEY wagonVolumetry_FK;
ALTER TABLE vn.wagonVolumetry MODIFY COLUMN wagonFk VARCHAR(6) NOT NULL;
ALTER TABLE vn.collectionWagon DROP FOREIGN KEY collectionWagon_wagon;
ALTER TABLE vn.collectionWagon MODIFY COLUMN wagonFk VARCHAR(6) NOT NULL;
ALTER TABLE vn.collectionWagonTicket DROP FOREIGN KEY collectionWagonTicket_wagon;
ALTER TABLE vn.collectionWagonTicket MODIFY COLUMN wagonFk VARCHAR(6) NOT NULL;
ALTER TABLE vn.wagon MODIFY COLUMN id varchar(6) NOT NULL COMMENT '26 letras de alfabeto inglés';
ALTER TABLE vn.wagonVolumetry ADD CONSTRAINT wagonVolumetry_FK_1 FOREIGN KEY (wagonFk) REFERENCES vn.wagon(id) ON UPDATE CASCADE;
ALTER TABLE vn.collectionWagon COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.collectionWagon MODIFY COLUMN wagonFk varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
ALTER TABLE vn.collectionWagon ADD CONSTRAINT collectionWagon_FK_1 FOREIGN KEY (wagonFk) REFERENCES vn.wagon(id) ON UPDATE CASCADE;
ALTER TABLE vn.collectionWagonTicket COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.collectionWagonTicket MODIFY COLUMN wagonFk varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_FK_1 FOREIGN KEY (wagonFk) REFERENCES vn.wagon(id) ON UPDATE CASCADE;