-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vagrant: Disable broken migration that prevents tidings migration fro…
…m executing
- Loading branch information
Showing
1 changed file
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
-- HACK: This migration is commented out, because it's turned out to be | ||
-- trouble. But, removing it from the sequence entirely also causes trouble. | ||
-- So, this is a no-op. | ||
|
||
-- | ||
-- The unique constraint got left out of an earlier actioncounters migration, | ||
-- so this schematic migration forcibly cleans up the few duplicates and adds | ||
-- the unique constraint. | ||
-- | ||
-- There should only be about 50 duplicates in 180000 or so production records. | ||
-- | ||
CREATE TEMPORARY TABLE dup_actioncounter_hashes | ||
SELECT unique_hash | ||
FROM actioncounters_actioncounterunique | ||
GROUP BY unique_hash | ||
HAVING count(unique_hash) > 1; | ||
|
||
DELETE FROM actioncounters_actioncounterunique | ||
WHERE unique_hash IN | ||
(SELECT unique_hash FROM dup_actioncounter_hashes); | ||
|
||
DROP INDEX actioncounters_actioncounterunique_unique | ||
ON actioncounters_actioncounterunique; | ||
|
||
ALTER TABLE actioncounters_actioncounterunique | ||
ADD UNIQUE actioncounters_actioncounterunique_unique (unique_hash); | ||
-- CREATE TEMPORARY TABLE dup_actioncounter_hashes | ||
-- SELECT unique_hash | ||
-- FROM actioncounters_actioncounterunique | ||
-- GROUP BY unique_hash | ||
-- HAVING count(unique_hash) > 1; | ||
-- | ||
-- DELETE FROM actioncounters_actioncounterunique | ||
-- WHERE unique_hash IN | ||
-- (SELECT unique_hash FROM dup_actioncounter_hashes); | ||
-- | ||
-- DROP INDEX actioncounters_actioncounterunique_unique | ||
-- ON actioncounters_actioncounterunique; | ||
-- | ||
-- ALTER TABLE actioncounters_actioncounterunique | ||
-- ADD UNIQUE actioncounters_actioncounterunique_unique (unique_hash); |