-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
33 lines (30 loc) · 1.05 KB
/
Copy pathschema.sql
File metadata and controls
33 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
create extension if not exists "uuid-ossp";
create table public.profiles (
id uuid references auth.users(id) on delete cascade primary key,
name text,
email text,
created_at timestamptz default now()
);
create table public.notes (
id uuid default uuid_generate_v4() primary key,
user_id uuid references public.profiles(id) on delete cascade not null,
title text not null default 'Untitled',
content text default '',
tags text[] default '{}',
category text default 'General',
is_archived boolean default false,
is_public boolean default false,
share_id text unique default encode(gen_random_bytes(6), 'hex'),
ai_summary text,
ai_action_items text[],
ai_suggested_title text,
created_at timestamptz default now(),
updated_at timestamptz default now()
);
create table public.ai_usage (
id uuid default uuid_generate_v4() primary key,
user_id uuid references public.profiles(id) on delete cascade not null,
note_id uuid references public.notes(id) on delete cascade,
type text not null,
created_at timestamptz default now()
);