Replies: 3 comments 1 reply
-
|
required 항목을 정해야 할 거 같네요~! |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
아 배리어 프리 관련 항목도 받아야할 것 같아요! 위치 조건 선택할 때 체크박스로 있어야할 것 같아요 |
Beta Was this translation helpful? Give feedback.
0 replies
-
-- ============================================================
-- 마주봄 DB 스키마
-- BFF(Next.js API Route)에서 service_role_key로만 접근
-- RLS 불필요 — 서버에서 user_id 필터링으로 접근 제어
-- ============================================================
-- ============================================================
-- 1. TABLES
-- ============================================================
-- users
create table users (
id bigint generated always as identity primary key,
nickname text not null,
created_at timestamptz not null default now()
);
-- profiles
create table profiles (
id bigint generated always as identity primary key,
user_id bigint not null unique references users(id) on delete cascade,
name text not null,
gender text not null,
education text not null,
region_primary text not null,
region_secondary text,
is_barrier_free boolean not null default false,
disability_type text not null,
disability_level text not null,
mobility text not null,
hand_usage text not null,
stamina text not null,
communication text not null,
instruction_level text not null,
hope_activities text[] not null default '{}',
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
-- bookmarks
create table bookmarks (
id bigint generated always as identity primary key,
user_id bigint not null references users(id) on delete cascade,
posting_title text not null,
posting_url text not null,
created_at timestamptz not null default now(),
unique (user_id, posting_url)
);
-- match_results
create table match_results (
id bigint generated always as identity primary key,
user_id bigint not null unique references users(id) on delete cascade,
radar_chart jsonb not null default '{}',
summary_text text not null default '',
top3_jobs jsonb not null default '[]',
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
-- ============================================================
-- 2. TRIGGERS — updated_at 자동 갱신
-- ============================================================
create or replace function set_updated_at()
returns trigger
language plpgsql
as $$
begin
new.updated_at = now();
return new;
end;
$$;
create trigger trg_profiles_updated_at
before update on profiles
for each row execute function set_updated_at();
create trigger trg_match_results_updated_at
before update on match_results
for each row execute function set_updated_at(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
수퍼베이스 확정
마주봄 — DB 스키마 정의서
1. users
2. profiles
3. bookmarks
4. match_results
프로필에서 가져올거 >
radar_chart 예시
{ "repetition": 85, "interpersonal": 30, "physical": 60, "hand_detail": 70, "env_sensitivity": 45 }top3_jobs 예시
[ { "rank": 1, "job_name": "문서 디지타이징", "match_pct": 92, "label": "잘 맞아요" }, { "rank": 2, "job_name": "택배 상하차 보조", "match_pct": 74, "label": "도전해볼 수 있어요" }, { "rank": 3, "job_name": "카페 바리스타", "match_pct": 51, "label": "힘들 수 있어요" } ]RLS 정책
트리거
child_profiles, match_results의
updated_at은 레코드 수정 시now()로 자동 갱신됩니다.Beta Was this translation helpful? Give feedback.
All reactions