Add database migration snapshots for comment_votes, comments, movies, and users tables

- Created 0009_snapshot.json with initial structure for comment_votes, comments, movies, and users tables.
- Created 0010_snapshot.json with updated structure for comments, including new fields: pinned and spoiler.
- Created 0011_snapshot.json with further updates to comments, adding anonymous field and refining existing structures.
This commit is contained in:
ngthanhvu
2026-07-24 00:06:03 -04:00
parent 70d8fc5bfa
commit 3d075f320c
22 changed files with 2832 additions and 74 deletions
+30
View File
@@ -102,3 +102,33 @@ with check (auth.uid() = user_id);
create policy "Users can delete own watch later movies"
on public.watch_later_movies for delete
using (auth.uid() = user_id);
create table public.comments (
id uuid primary key default gen_random_uuid(),
user_id uuid not null references auth.users(id) on delete cascade,
source text not null default '',
slug text not null,
movie_name text,
content text not null,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
alter table public.comments enable row level security;
create policy "Anyone can read comments"
on public.comments for select
using (true);
create policy "Authenticated users can insert comments"
on public.comments for insert
with check (auth.uid() = user_id);
create policy "Users can update own comments"
on public.comments for update
using (auth.uid() = user_id)
with check (auth.uid() = user_id);
create policy "Users can delete own comments"
on public.comments for delete
using (auth.uid() = user_id);