1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 15:21:03 +01:00
phorge-phorge/resources/sql/autopatches/20180124.herald.01.repetition.sql
epriestley 204d1de683 Convert storage for Herald repetition policy to "text32"
Summary:
Depends on D18926. Ref T6203. Ref T13048. Herald rule repetition policies are stored as integers but treated as strings in most contexts.

After D18926, the integer stuff is almost totally hidden inside `HeraldRule` and getting rid of it completely isn't too tricky.

Do so now.

Test Plan:
  - Created "only the first time" and "every time" rules. Did a SELECT on their rows in the database.
  - Ran migrations, got a clean bill of health from `storage adjust`.
  - Did another SELECT on the rows, saw a faithful conversion to strings "every" and "first".
  - Edited and reviewed rules, swapping them between "every" and "first".

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13048, T6203

Differential Revision: https://secure.phabricator.com/D18927
2018-01-26 11:05:37 -08:00

22 lines
605 B
SQL

/* This column was previously "uint32?" with these values:
1: run every time
0: run only the first time
*/
ALTER TABLE {$NAMESPACE}_herald.herald_rule
CHANGE repetitionPolicy
repetitionPolicy VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT};
/* If the old value was "0", the new value is "first". */
UPDATE {$NAMESPACE}_herald.herald_rule
SET repetitionPolicy = 'first'
WHERE repetitionPolicy = '0';
/* If the old value was anything else, the new value is "every". */
UPDATE {$NAMESPACE}_herald.herald_rule
SET repetitionPolicy = 'every'
WHERE repetitionPolicy NOT IN ('first', '0');