Skip to content

Commit 1c5bbae

Browse files
committed
fix: add migrations
1 parent b4e940d commit 1c5bbae

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
2+
3+
CREATE TABLE IF NOT EXISTS users
4+
(
5+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
6+
google_id VARCHAR(255) NOT NULL UNIQUE,
7+
email VARCHAR(255) NOT NULL UNIQUE,
8+
full_name VARCHAR(255) NOT NULL,
9+
reputation INT NOT NULL DEFAULT 0,
10+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
11+
picture TEXT NOT NULL DEFAULT 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg'
12+
);
13+
14+
15+
CREATE TABLE IF NOT EXISTS notes
16+
(
17+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
18+
course_name VARCHAR(255) NOT NULL,
19+
course_code VARCHAR(50) NOT NULL,
20+
description TEXT,
21+
professor_names TEXT[],
22+
tags TEXT[] NOT NULL DEFAULT '{}',
23+
is_public BOOLEAN NOT NULL DEFAULT TRUE,
24+
has_preview_image BOOLEAN NOT NULL DEFAULT FALSE,
25+
uploader_user_id UUID NOT NULL REFERENCES users (id) ON DELETE CASCADE,
26+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
27+
downloads INT NOT NULL DEFAULT 0
28+
);
29+
30+
31+
CREATE TABLE IF NOT EXISTS votes
32+
(
33+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
34+
user_id UUID NOT NULL REFERENCES users (id) ON DELETE CASCADE,
35+
note_id UUID NOT NULL REFERENCES notes (id) ON DELETE CASCADE,
36+
is_upvote BOOLEAN NOT NULL,
37+
created_at TIMESTAMPTZ DEFAULT NOW(),
38+
UNIQUE (user_id, note_id)
39+
);

frontend/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VITE_GOOGLE_CLIENT_ID=643119946598-6hht5inutpi1sulp1gbdve24r4aa3hub.apps.googleusercontent.com
1+
VITE_GOOGLE_CLIENT_ID=436884976085-r5fovvin9lur9876sr2nso8r601frdg5.apps.googleusercontent.com
22
VITE_API_BASE_URL=https://cfmn-server.metakgp.org

0 commit comments

Comments
 (0)