-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve migration conflict, add comments
- Loading branch information
Showing
4 changed files
with
47 additions
and
60 deletions.
There are no files selected for viewing
59 changes: 0 additions & 59 deletions
59
corehq/motech/repeaters/migrations/0015_alter_repeatrecord_state_and_more.py
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
Adds an index for RepeatRecord.state and a partial index for | ||
next_attempt_at + not_paused. The indexes are used by | ||
RepeaterManager.all_ready() to select all Repeaters that have | ||
RepeatRecords that are ready to be sent. | ||
""" | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
|
||
dependencies = [ | ||
("repeaters", "0015_repeater_max_workers"), | ||
] | ||
|
||
operations = [ | ||
# Adds an index for RepeatRecord.state. Builds it concurrently. | ||
# The SQL and the index name were determined from the generated | ||
# Django migration. The migration was made concurrent by setting | ||
# `atomic = False` and adding "CONCURRENTLY" to the SQL. | ||
migrations.RunSQL( | ||
sql=""" | ||
CREATE INDEX CONCURRENTLY "repeaters_repeatrecord_state_8055083b" | ||
ON "repeaters_repeatrecord" ("state"); | ||
""", | ||
reverse_sql=""" | ||
DROP INDEX CONCURRENTLY "repeaters_repeatrecord_state_8055083b"; | ||
""" | ||
), | ||
|
||
# Adds an index for Repeater.next_attempt_at when | ||
# Repeater.is_paused is False. Builds it concurrently. | ||
migrations.RunSQL( | ||
sql=""" | ||
CREATE INDEX CONCURRENTLY "next_attempt_at_not_paused_idx" | ||
ON "repeaters_repeater" ("next_attempt_at") | ||
WHERE NOT "is_paused"; | ||
""", | ||
reverse_sql=""" | ||
DROP INDEX CONCURRENTLY "next_attempt_at_not_paused_idx"; | ||
""" | ||
) | ||
] |
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