Skip to content

Commit

Permalink
Fix drop foreign key query
Browse files Browse the repository at this point in the history
  • Loading branch information
fellmirr committed Nov 14, 2024
1 parent dc49521 commit 896befc
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,24 +164,24 @@ CALL convert_to_utf8mb4();
DROP PROCEDURE convert_to_utf8mb4;

-- Now for the cases where we need to remove some foreign keys before we can change the character set
DROP FOREIGN KEY `FK_agreementID_ID` ON `Vipps_agreement_charges`;
ALTER TABLE `Vipps_agreement_charges` DROP FOREIGN KEY `FK_agreementID_ID`;

-- Update the character set and collation for the columns
ALTER TABLE `EffektDonasjonDB`.`Vipps_agreement_charges`
ALTER TABLE `Vipps_agreement_charges`
CHANGE COLUMN `agreementID` `agreementID` VARCHAR(20) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL;

ALTER TABLE `EffektDonasjonDB`.`Vipps_agreements`
ALTER TABLE `Vipps_agreements`
CHANGE COLUMN `ID` `ID` VARCHAR(20) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL ;

-- Add the foreign key back
ALTER TABLE `Vipps_agreement_charges`
ADD CONSTRAINT `FK_agreementID_ID` FOREIGN KEY (`agreementID`) REFERENCES `Vipps_agreements`(`ID`) ON DELETE CASCADE ON UPDATE CASCADE;

-- Drop search index on Donors table
ALTER TABLE `EffektDonasjonDB`.`Donors` DROP INDEX `search`;
ALTER TABLE `Donors` DROP INDEX `search`;

-- Update the character set and collation for the columns
ALTER TABLE `EffektDonasjonDB`.`Donors`
ALTER TABLE `Donors`
CHANGE COLUMN `email` `email` TINYTEXT CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL COMMENT 'epost registrert i donasjonsskjema,\\\\ntrigger generering av ny donor hvis den ikke eksisterer fra før' ,
CHANGE COLUMN `full_name` `full_name` TINYTEXT CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NULL DEFAULT NULL ;

Expand Down

0 comments on commit 896befc

Please sign in to comment.