Skip to content

Commit 6bbd9ab

Browse files
feat: database schema, RLS policies, and sign-up trigger (#23) (#34)
Co-authored-by: Ona <no-reply@ona.com>
1 parent e5e199d commit 6bbd9ab

3 files changed

Lines changed: 402 additions & 2 deletions

File tree

.agents/architecture.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ Vercel → hosting, preview deploys per PR, production deploys on merge
2828

2929
## Data Model
3030

31-
No database migrations exist yet. The schema below is the planned target model.
32-
Create migrations in `supabase/migrations/` as features are implemented.
31+
The foundational schema is implemented in `supabase/migrations/20260415092907_create_schema.sql`.
3332
See `docs/product-spec.md` → Data Model for the full column-level schema.
3433

3534
```

src/lib/types.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Database entity types matching the Supabase schema.
2+
3+
export type MemberRole = "owner" | "admin" | "member";
4+
export type InviteRole = "admin" | "member";
5+
6+
export interface Profile {
7+
id: string;
8+
email: string;
9+
display_name: string;
10+
avatar_url: string | null;
11+
created_at: string;
12+
}
13+
14+
export interface Workspace {
15+
id: string;
16+
name: string;
17+
slug: string;
18+
is_personal: boolean;
19+
created_by: string;
20+
created_at: string;
21+
updated_at: string;
22+
}
23+
24+
export interface Member {
25+
id: string;
26+
workspace_id: string;
27+
user_id: string;
28+
role: MemberRole;
29+
invited_by: string | null;
30+
invited_at: string | null;
31+
joined_at: string | null;
32+
created_at: string;
33+
}
34+
35+
export interface WorkspaceInvite {
36+
id: string;
37+
workspace_id: string;
38+
email: string;
39+
role: InviteRole;
40+
invited_by: string;
41+
token: string;
42+
expires_at: string;
43+
accepted_at: string | null;
44+
created_at: string;
45+
}
46+
47+
export interface Page {
48+
id: string;
49+
workspace_id: string;
50+
parent_id: string | null;
51+
title: string;
52+
content: Record<string, unknown> | null;
53+
icon: string | null;
54+
position: number;
55+
created_by: string;
56+
created_at: string;
57+
updated_at: string;
58+
}

0 commit comments

Comments
 (0)