Home | History | Annotate | Download | only in migrations
      1 UP_SQL = """
      2 ALTER TABLE afe_job_keyvals DROP FOREIGN KEY `afe_job_keyvals_ibfk_1`;
      3 """
      4 
      5 # Before syncing down, you must cleanup the rows that do not meet
      6 # the foreign key constraint by:
      7 #
      8 # DELETE t1 FROM afe_job_keyvals t1
      9 # LEFT OUTER JOIN afe_jobs t2
     10 # ON (t1.job_id = t2.id) WHERE t2.id is NULL;
     11 #
     12 # Execute with care!
     13 
     14 DOWN_SQL = """
     15 ALTER TABLE afe_job_keyvals
     16 ADD CONSTRAINT afe_job_keyvals_ibfk_1 FOREIGN KEY
     17 (`job_id`) REFERENCES `afe_jobs`(`id`)
     18 ON DELETE NO ACTION;
     19 """
     20