ZQIIC7C3GKGW5G5LHOEEVJQH5HR2RJAN5C67Y4LFFBFFZTKNRXIAC
-- Add field to store timestamp of joining game
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_class c
INNER JOIN pg_namespace n ON n.oid = c.relnamespace
INNER JOIN pg_attribute a ON a.attrelid = c.oid
WHERE c.relname = 'players' AND n.nspname = 'games' AND a.attname = 'create_ts'
) THEN
ALTER TABLE games.players ADD COLUMN create_ts TIMESTAMP WITHOUT TIME ZONE NULL;
END IF;
END
$$;