-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase..sql
More file actions
34 lines (27 loc) · 1.06 KB
/
Copy pathsupabase..sql
File metadata and controls
34 lines (27 loc) · 1.06 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
34
-- ==========================================
-- 1. DATABASE SCHEMA SETUP
-- ==========================================
-- Drop the table if it already exists (clean slate)
DROP TABLE IF EXISTS workshop_users;
-- Create a dedicated table for our custom authentication workshop
CREATE TABLE workshop_users (
id BIGSERIAL PRIMARY KEY,
email TEXT UNIQUE NOT NULL,
password TEXT NOT NULL, -- NOTE: In production apps, never store plaintext passwords!
full_name TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Enable Row Level Security (RLS)
ALTER TABLE workshop_users ENABLE ROW LEVEL SECURITY;
-- Create an open Read policy for the sake of the practical session demo
CREATE POLICY "Allow public read access"
ON workshop_users
FOR SELECT
USING (true);
-- ==========================================
-- 2. SEED DATA (TEST CREDENTIALS)
-- ==========================================
INSERT INTO workshop_users (email, password, full_name)
VALUES
('member@gdg.com', 'password123', 'GDG Chapter Member'),
('admin@workshop.io', 'securepass987', 'Session Lead');