Skip to content

Commit

Permalink
proper evolution fix for mysql 5.6 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Zurek committed Jan 31, 2015
1 parent b1e2a22 commit ab88618
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ db.default.driver="com.mysql.jdbc.Driver"
db.default.url="jdbc:mysql://localhost/femr?characterEncoding=UTF-8"
db.default.user="sa"
db.default.password=""
db.default.logStatements=false

photos.path="./Upload/Pictures/Patients"
photos.encounterPath="./Upload/Pictures/PatientEncounters"
Expand Down
10 changes: 10 additions & 0 deletions conf/evolutions/default/69.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# --- !Ups

ALTER TABLE `patient_encounters`
DROP FOREIGN KEY `fk_patient_encounter_patient_age_classification_id`;

ALTER TABLE `patient_age_classifications`
CHANGE COLUMN `id` `id` INT(11) NOT NULL ,
ADD COLUMN `sortOrder` INT NOT NULL AUTO_INCREMENT AFTER `isDeleted`,
ADD UNIQUE INDEX `sortOrder_UNIQUE` (`sortOrder` ASC);

ALTER TABLE `patient_encounters`
ADD CONSTRAINT `fk_patient_encounter_patient_age_classification_id`
FOREIGN KEY (`patient_age_classification_id`)
REFERENCES `patient_age_classifications` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

# --- !Downs

ALTER TABLE `patient_age_classifications`
Expand Down
10 changes: 10 additions & 0 deletions conf/evolutions/default/70.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# --- !Ups

ALTER TABLE `patient_encounters`
DROP FOREIGN KEY `fk_patient_encounter_patient_age_classification_id`;

ALTER TABLE `patient_age_classifications`
CHANGE COLUMN `id` `id` INT(11) NOT NULL AUTO_INCREMENT ,
CHANGE COLUMN `sortOrder` `sortOrder` INT(11) NOT NULL ;

ALTER TABLE `patient_encounters`
ADD CONSTRAINT `fk_patient_encounter_patient_age_classification_id`
FOREIGN KEY (`patient_age_classification_id`)
REFERENCES `patient_age_classifications` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

# --- !Downs

ALTER TABLE `patient_age_classifications`
Expand Down
10 changes: 10 additions & 0 deletions conf/scripts/upgrade_213.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Before upgrading to fEMR 2.1.3, run these scripts and upgrade MySQL to 5.6.
-- Seriously, goodluck reverting back.

UPDATE `play_evolutions`
SET `apply_script`='ALTER TABLE `patient_encounters`\nDROP FOREIGN KEY `fk_patient_encounter_patient_age_classification_id`;\n\nALTER TABLE `patient_age_classifications`\nCHANGE COLUMN `id` `id` INT(11) NOT NULL ,\nADD COLUMN `sortOrder` INT NOT NULL AUTO_INCREMENT AFTER `isDeleted`,\nADD UNIQUE INDEX `sortOrder_UNIQUE` (`sortOrder` ASC);\n\nALTER TABLE `patient_encounters`\nADD CONSTRAINT `fk_patient_encounter_patient_age_classification_id`\nFOREIGN KEY (`patient_age_classification_id`)\nREFERENCES `patient_age_classifications` (`id`)\nON DELETE NO ACTION\nON UPDATE NO ACTION;'
WHERE `id`='69';

UPDATE `play_evolutions`
SET `apply_script`='ALTER TABLE `patient_encounters`\nDROP FOREIGN KEY `fk_patient_encounter_patient_age_classification_id`;\n\nALTER TABLE `patient_age_classifications`\nCHANGE COLUMN `id` `id` INT(11) NOT NULL AUTO_INCREMENT ,\nCHANGE COLUMN `sortOrder` `sortOrder` INT(11) NOT NULL ;\n\nALTER TABLE `patient_encounters`\nADD CONSTRAINT `fk_patient_encounter_patient_age_classification_id`\nFOREIGN KEY (`patient_age_classification_id`)\nREFERENCES `patient_age_classifications` (`id`)\nON DELETE NO ACTION\nON UPDATE NO ACTION;'
WHERE `id`='70';

0 comments on commit ab88618

Please sign in to comment.