X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=upgrade%2F1.0.1%2F07_ids_foreign_keys.sql;h=2ac102143324c1aa0a984566f6e449a6a463a7a3;hb=69d311a9e667ba071af1070cfe9a6906a4f0ed32;hp=59d3fb2e08be9b90ff574e2a4bf6f7c6925b57b4;hpb=cecdf74795e71ed038411915dad5e0dff6ea51fa;p=platal.git diff --git a/upgrade/1.0.1/07_ids_foreign_keys.sql b/upgrade/1.0.1/07_ids_foreign_keys.sql index 59d3fb2..2ac1021 100644 --- a/upgrade/1.0.1/07_ids_foreign_keys.sql +++ b/upgrade/1.0.1/07_ids_foreign_keys.sql @@ -6,6 +6,7 @@ UPDATE register_marketing SET sender = NULL WHERE sender = 0; UPDATE register_mstats SET sender = NULL WHERE sender = 0; UPDATE requests SET pid = NULL WHERE pid = 0; UPDATE profile_addresses SET pid = NULL WHERE pid = 0; +UPDATE survey_votes SET uid = NULL WHERE uid = 0; -- Deltes erroneous data. DELETE FROM homonyms WHERE NOT EXISTS (SELECT * FROM accounts WHERE accounts.uid = homonyms.homonyme_id); @@ -16,6 +17,7 @@ DELETE FROM forum_profiles WHERE NOT EXISTS (SELECT * FROM accounts WHERE accoun DELETE FROM watch WHERE NOT EXISTS (SELECT * FROM accounts WHERE accounts.uid = watch.uid); DELETE FROM group_event_participants WHERE NOT EXISTS (SELECT * FROM accounts WHERE accounts.uid = group_event_participants.uid); DELETE FROM group_members WHERE NOT EXISTS (SELECT * FROM accounts WHERE accounts.uid = group_members.uid); +DELETE FROM axletter_ins WHERE NOT EXISTS (SELECT * FROM accounts WHERE accounts.uid = axletter_ins.uid); -- Following tables all refer to accounts.uid. ALTER TABLE account_auth_openid ADD FOREIGN KEY (uid) REFERENCES accounts (uid) ON DELETE CASCADE ON UPDATE CASCADE; @@ -62,7 +64,6 @@ ALTER TABLE watch_promo ADD FOREIGN KEY (uid) REFERENCES accounts (uid) ON DELET -- Following tables all refer to accounts.uid, but they use a different name. ALTER TABLE contacts ADD FOREIGN KEY (contact) REFERENCES accounts (uid) ON DELETE CASCADE ON UPDATE CASCADE; -ALTER TABLE email_list_moderate ADD FOREIGN KEY (mid) REFERENCES accounts (uid) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE gapps_accounts ADD FOREIGN KEY (l_userid) REFERENCES accounts (uid) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE gapps_queue ADD FOREIGN KEY (q_owner_id) REFERENCES accounts (uid) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE gapps_queue ADD FOREIGN KEY (q_recipient_id) REFERENCES accounts (uid) ON DELETE CASCADE ON UPDATE CASCADE;