mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
fix(multiplayer): reconcile authoritative initial connections
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user