-- Add field to choose password type to reset

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 = 'reset_tokens' AND n.nspname = 'auth' AND a.attname = 'is_game_pwd'
    ) THEN
        ALTER TABLE auth.reset_tokens ADD COLUMN is_game_pwd BOOLEAN NOT NULL DEFAULT TRUE;
    END IF;
END
$$;