Spaces:
Sleeping
Sleeping
Download backend/sql/009_age_verification.sql from stylevoice/talk: direct link, hf CLI and curl.
- Browser
- Download file 2.88 kB
-
https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/009_age_verification.sql
- Command line
-
hf download hf://spaces/stylevoice/talk/backend/sql/009_age_verification.sql
-
curl -L -o 009_age_verification.sql https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/009_age_verification.sql
2.88 kB
| -- 18+ ์ฐ๋ น ์ธ์ฆ (2026-05-03) | |
| -- | |
| -- ์ฑ์ธ ๋ํ ๋ชจ๋(spice_level=hot) ๋ฐ ์์ ๋ํ ์ฑํ ยท์์ฑ ์ง์ ์ ํ์ํ | |
| -- ์๊ฐ ์ธ์ฆ(self-attestation) + ๋์ ๋ก๊ทธ ๋ณด๊ด. | |
| -- | |
| -- ํฅํ ์ ์ ๋ณธ์ธ์ธ์ฆ(๋ค๋ ยทPASS ๋ฑ) ํตํฉ ์๋ฆฌ ๋ง๋ จ. method ์ปฌ๋ผ์ด ์ธ์ฆ ์๋จ์ ๊ตฌ๋ถ. | |
| -- | |
| -- ํ๊ตญ ์ ๋ณดํต์ ๋ง๋ฒ / ์ผ๋ณธ ํน์๋ฒ(JP ํ์ฅ ์) ๋ชจ๋ ๋ง์กฑํ๋ ์ต์ ์๊ฑด: | |
| -- - ๋ช ์์ ๋์ ์์ ๊ธฐ๋ก (verified_at) | |
| -- - ๋์ ์ IPยทuser_agent ๊ธฐ๋ก (๋ถ์ ์ ์ ์ฆ) | |
| -- - ๋์ ๋ณธ๋ฌธ์ ๋ฒ์ ์ถ์ (consent_text_version) โ ์ฝ๊ด ๋ณ๊ฒฝ ์ ์ฌ๋์ ํธ๋ฆฌ๊ฑฐ | |
| -- - ์ฒ ํ(revoke) ๊ฐ๋ฅ์ฑ โ ์ฌ์ฉ์ ์์ฒญ ์ ์ฆ์ ๋ฌดํจํ | |
| CREATE TABLE IF NOT EXISTS public.user_age_verifications ( | |
| user_id UUID PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE, | |
| verified BOOLEAN NOT NULL DEFAULT false, | |
| verified_at TIMESTAMPTZ, | |
| method VARCHAR(32) NOT NULL DEFAULT 'self_attestation', | |
| -- 'self_attestation' | 'danal_phone' | 'pass' | 'ipin' (ํ์ฅ ์๋ฆฌ) | |
| ip_address INET, | |
| user_agent TEXT, | |
| consent_text_version VARCHAR(16) NOT NULL DEFAULT 'v1', | |
| revoked_at TIMESTAMPTZ, | |
| created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | |
| updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | |
| ); | |
| -- RLS: ๋ณธ์ธ๋ง ์กฐํ, service_role(๋ฐฑ์๋)๋ง ์์ | |
| ALTER TABLE public.user_age_verifications ENABLE ROW LEVEL SECURITY; | |
| CREATE POLICY "Users can read own age verification" ON public.user_age_verifications | |
| FOR SELECT USING (auth.uid() = user_id); | |
| -- ๋์ ์ด๋ ฅ ๋ก๊ทธ (๊ฐ์ฌ์ฉ โ ๋์ยท์ฒ ํยท์ฌ๋์ ๋ชจ๋ ์ถ์ ) | |
| CREATE TABLE IF NOT EXISTS public.age_verification_logs ( | |
| id BIGSERIAL PRIMARY KEY, | |
| user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE, | |
| event VARCHAR(16) NOT NULL, -- 'verified' | 'revoked' | 're_verified' | |
| method VARCHAR(32) NOT NULL DEFAULT 'self_attestation', | |
| ip_address INET, | |
| user_agent TEXT, | |
| consent_text_version VARCHAR(16) NOT NULL DEFAULT 'v1', | |
| detail JSONB NOT NULL DEFAULT '{}', | |
| created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | |
| ); | |
| CREATE INDEX IF NOT EXISTS idx_age_verification_logs_user | |
| ON public.age_verification_logs(user_id, created_at DESC); | |
| ALTER TABLE public.age_verification_logs ENABLE ROW LEVEL SECURITY; | |
| CREATE POLICY "Users can read own age logs" ON public.age_verification_logs | |
| FOR SELECT USING (auth.uid() = user_id); | |
| -- updated_at ์๋ ๊ฐฑ์ trigger | |
| CREATE OR REPLACE FUNCTION public.tg_age_verifications_updated_at() | |
| RETURNS TRIGGER AS $$ | |
| BEGIN | |
| NEW.updated_at = NOW(); | |
| RETURN NEW; | |
| END; | |
| $$ LANGUAGE plpgsql; | |
| DROP TRIGGER IF EXISTS trg_age_verifications_updated_at ON public.user_age_verifications; | |
| CREATE TRIGGER trg_age_verifications_updated_at | |
| BEFORE UPDATE ON public.user_age_verifications | |
| FOR EACH ROW EXECUTE FUNCTION public.tg_age_verifications_updated_at(); | |