-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
23 lines (20 loc) · 1.08 KB
/
Copy pathschema.sql
File metadata and controls
23 lines (20 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- =================================================================
-- PUSAKA — Database Schema (Neon / Postgres)
-- =================================================================
-- Jalankan file ini sekali di Neon SQL Editor sebelum deploy,
-- atau lewat: psql "$DATABASE_URL" -f schema.sql
CREATE TABLE IF NOT EXISTS participants (
id TEXT PRIMARY KEY,
nama TEXT NOT NULL,
kategori TEXT NOT NULL CHECK (kategori IN ('laki-laki', 'perempuan')),
status TEXT NOT NULL DEFAULT 'belum' CHECK (status IN ('belum', 'hadir', 'tidak-hadir')),
alasan TEXT DEFAULT '',
bukti_transfer_url TEXT DEFAULT '',
bukti_dikonfirmasi BOOLEAN DEFAULT FALSE,
updated_at TIMESTAMPTZ
);
-- Mencegah nama duplikat di kategori yang sama (case-insensitive)
CREATE UNIQUE INDEX IF NOT EXISTS idx_participants_nama_kategori
ON participants (LOWER(nama), kategori);
CREATE INDEX IF NOT EXISTS idx_participants_kategori ON participants (kategori);
CREATE INDEX IF NOT EXISTS idx_participants_status ON participants (status);