mirror of
https://github.com/willchen96/mike.git
synced 2026-07-24 23:41:04 +02:00
feat: add library and refresh shared table UI
This commit is contained in:
parent
e32daad5a4
commit
f0b90ab3b4
99 changed files with 9859 additions and 5241 deletions
|
|
@ -222,14 +222,36 @@ create table if not exists public.project_subfolders (
|
|||
create index if not exists idx_project_subfolders_project
|
||||
on public.project_subfolders(project_id);
|
||||
|
||||
create table if not exists public.library_folders (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
user_id text not null,
|
||||
library_kind text not null default 'file',
|
||||
name text not null,
|
||||
parent_folder_id uuid references public.library_folders(id) on delete cascade,
|
||||
created_at timestamptz not null default now(),
|
||||
updated_at timestamptz not null default now(),
|
||||
constraint library_folders_kind_check
|
||||
check (library_kind in ('file', 'template'))
|
||||
);
|
||||
|
||||
create index if not exists idx_library_folders_user_kind
|
||||
on public.library_folders(user_id, library_kind);
|
||||
|
||||
create index if not exists idx_library_folders_parent
|
||||
on public.library_folders(parent_folder_id);
|
||||
|
||||
create table if not exists public.documents (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
project_id uuid references public.projects(id) on delete cascade,
|
||||
user_id text not null,
|
||||
status text not null default 'pending',
|
||||
folder_id uuid references public.project_subfolders(id) on delete set null,
|
||||
library_kind text not null default 'file',
|
||||
library_folder_id uuid references public.library_folders(id) on delete set null,
|
||||
created_at timestamptz not null default now(),
|
||||
updated_at timestamptz not null default now()
|
||||
updated_at timestamptz not null default now(),
|
||||
constraint documents_library_kind_check
|
||||
check (library_kind in ('file', 'template'))
|
||||
);
|
||||
|
||||
create index if not exists idx_documents_user_project
|
||||
|
|
@ -238,6 +260,10 @@ create index if not exists idx_documents_user_project
|
|||
create index if not exists idx_documents_project_folder
|
||||
on public.documents(project_id, folder_id);
|
||||
|
||||
create index if not exists idx_documents_library_kind_folder
|
||||
on public.documents(user_id, library_kind, library_folder_id)
|
||||
where project_id is null;
|
||||
|
||||
create table if not exists public.document_versions (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
document_id uuid not null references public.documents(id) on delete cascade,
|
||||
|
|
@ -837,6 +863,7 @@ alter table public.courtlistener_opinion_cluster_index enable row level security
|
|||
revoke all on public.user_profiles from anon, authenticated;
|
||||
revoke all on public.projects from anon, authenticated;
|
||||
revoke all on public.project_subfolders from anon, authenticated;
|
||||
revoke all on public.library_folders from anon, authenticated;
|
||||
revoke all on public.documents from anon, authenticated;
|
||||
revoke all on public.document_versions from anon, authenticated;
|
||||
revoke all on public.document_edits from anon, authenticated;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue