Files
prod/migrations/20261017120000_release_game_exports.sql
T
2026-10-17 16:01:35 +07:00

12 lines
518 B
SQL

-- +goose Up
ALTER TABLE game_exports ADD COLUMN released_at TIMESTAMPTZ;
DROP INDEX game_exports_active;
CREATE UNIQUE INDEX game_exports_active ON game_exports(game_id)
WHERE state IN ('preparing', 'ready') AND released_at IS NULL;
-- +goose Down
-- Refuse rollback if retained ready exports cannot fit the old unique index.
DROP INDEX game_exports_active;
CREATE UNIQUE INDEX game_exports_active ON game_exports(game_id) WHERE state IN ('preparing', 'ready');
ALTER TABLE game_exports DROP COLUMN released_at;