mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-22 05:47:39 +00:00
store: add the drop_taken_codes migration
This commit is contained in:
1 parent
9324ea9248
commit
cf76edcd2b
2 files changed
+50
-2
No files matched your search
@@ -21,7 +21,8 @@ schemaMigrations =
|
||||
("20260918_badge_group_ops", m20260918_badge_group_ops, Just down_m20260918_badge_group_ops),
|
||||
("20260925_badge_store_receipts", m20260925_badge_store_receipts, Just down_m20260925_badge_store_receipts),
|
||||
("20261012_badge_subscriptions", m20261012_badge_subscriptions, Just down_m20261012_badge_subscriptions),
|
||||
("20261013_names", m20261013_names, Just down_m20261013_names)
|
||||
("20261013_names", m20261013_names, Just down_m20261013_names),
|
||||
("20261022_drop_taken_codes", m20261022_drop_taken_codes, Just down_m20261022_drop_taken_codes)
|
||||
]
|
||||
|
||||
-- | The client tables share this database, so the service tables are the same names behind a prefix.
|
||||
@@ -450,6 +451,29 @@ DROP TABLE @name_registrations;
|
||||
DROP TABLE @name_prepaid_codes;
|
||||
|]
|
||||
|
||||
-- A code_issued order's worth went into its code, which stays a valid prepaid code, so it ends taken with nothing left.
|
||||
m20261022_drop_taken_codes :: Text
|
||||
m20261022_drop_taken_codes =
|
||||
withPrefix
|
||||
servicePrefix
|
||||
[r|
|
||||
UPDATE @name_registrations SET version = version + 1, phase = 'taken', price = 0, live = 0 WHERE phase = 'code_issued';
|
||||
|
||||
DROP INDEX @idx_name_registrations_issued_code;
|
||||
|
||||
ALTER TABLE @name_registrations DROP COLUMN issued_code_id;
|
||||
|]
|
||||
|
||||
down_m20261022_drop_taken_codes :: Text
|
||||
down_m20261022_drop_taken_codes =
|
||||
withPrefix
|
||||
servicePrefix
|
||||
[r|
|
||||
ALTER TABLE @name_registrations ADD COLUMN issued_code_id BIGINT REFERENCES @name_prepaid_codes;
|
||||
|
||||
CREATE INDEX @idx_name_registrations_issued_code ON @name_registrations(issued_code_id);
|
||||
|]
|
||||
|
||||
{- TODO [badges] deferred with the draft in M20260915_user_badges, service only.
|
||||
|
||||
ALTER TABLE @payments ADD COLUMN receipt_hash BYTEA;
|
||||
|
||||
@@ -22,7 +22,8 @@ schemaMigrations =
|
||||
("20260918_badge_group_ops", m20260918_badge_group_ops, Just down_m20260918_badge_group_ops),
|
||||
("20260925_badge_store_receipts", m20260925_badge_store_receipts, Just down_m20260925_badge_store_receipts),
|
||||
("20261012_badge_subscriptions", m20261012_badge_subscriptions, Just down_m20261012_badge_subscriptions),
|
||||
("20261013_names", m20261013_names, Just down_m20261013_names)
|
||||
("20261013_names", m20261013_names, Just down_m20261013_names),
|
||||
("20261022_drop_taken_codes", m20261022_drop_taken_codes, Just down_m20261022_drop_taken_codes)
|
||||
]
|
||||
|
||||
-- | The client tables share this database, so the service tables are the same names behind a prefix.
|
||||
@@ -452,6 +453,29 @@ DROP TABLE @name_registrations;
|
||||
DROP TABLE @name_prepaid_codes;
|
||||
|]
|
||||
|
||||
-- A code_issued order's worth went into its code, which stays a valid prepaid code, so it ends taken with nothing left.
|
||||
m20261022_drop_taken_codes :: Query
|
||||
m20261022_drop_taken_codes =
|
||||
withPrefix
|
||||
servicePrefix
|
||||
[sql|
|
||||
UPDATE @name_registrations SET version = version + 1, phase = 'taken', price = 0, live = 0 WHERE phase = 'code_issued';
|
||||
|
||||
DROP INDEX @idx_name_registrations_issued_code;
|
||||
|
||||
ALTER TABLE @name_registrations DROP COLUMN issued_code_id;
|
||||
|]
|
||||
|
||||
down_m20261022_drop_taken_codes :: Query
|
||||
down_m20261022_drop_taken_codes =
|
||||
withPrefix
|
||||
servicePrefix
|
||||
[sql|
|
||||
ALTER TABLE @name_registrations ADD COLUMN issued_code_id INTEGER REFERENCES @name_prepaid_codes;
|
||||
|
||||
CREATE INDEX @idx_name_registrations_issued_code ON @name_registrations(issued_code_id);
|
||||
|]
|
||||
|
||||
{- TODO [badges] deferred with the draft in M20260915_user_badges, service only.
|
||||
|
||||
ALTER TABLE @payments ADD COLUMN receipt_hash BLOB;
|
||||
|
||||
Reference in new issue
Block a user