mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
14 lines
603 B
SQL
14 lines
603 B
SQL
ALTER TABLE matches
|
|
ADD COLUMN initial_connect_ready_at TIMESTAMPTZ;
|
|
|
|
-- Existing in-flight matches receive a fresh, fair connection window when
|
|
-- this migration is deployed. Future rows are stamped by the transition to
|
|
-- ASSIGNMENT_READY, not by match creation or provider allocation.
|
|
UPDATE matches
|
|
SET initial_connect_ready_at = now()
|
|
WHERE state IN ('ASSIGNMENT_READY', 'ASSIGNED', 'CONNECTING');
|
|
|
|
ALTER TABLE matches
|
|
ADD CONSTRAINT matches_initial_connect_ready_at
|
|
CHECK (state NOT IN ('ASSIGNMENT_READY', 'ASSIGNED', 'CONNECTING') OR initial_connect_ready_at IS NOT NULL) NOT VALID;
|