Skip to content

Commit cbfb6e4

Browse files
authored
Merge pull request #24 from sidvasu/main
Changed board schemas
2 parents 8336eab + ebb2c25 commit cbfb6e4

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

internal/db/sqlite/queries.sql

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,3 @@ FROM
6767
announcement
6868
WHERE
6969
uuid = ?;
70-
71-
72-
-- name: GetBoard :exec
73-
SELECT
74-
name,
75-
branch,
76-
github,
77-
discord,
78-
year,
79-
experiences,
80-
interests
81-
FROM
82-
board
83-
WHERE
84-
name = ?;

internal/db/sqlite/schema.sql

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,27 @@ CREATE TABLE IF NOT EXISTS announcement (
2727
--UNIQUE (id)
2828
);
2929

30-
CREATE TABLE IF NOT EXISTS board (
31-
name TEXT PRIMARY KEY,
32-
branch TEXT NOT NULL,
33-
github TEXT,
34-
discord TEXT,
30+
CREATE TABLE IF NOT EXISTS board_member (
31+
id CHAR(4) PRIMARY KEY,
32+
name VARCHAR(30) NOT NULL,
33+
branch VARCHAR(20) NOT NULL,
34+
github VARCHAR(39),
35+
discord VARCHAR(32),
3536
year INT,
36-
experiences TEXT,
37-
interests TEXT
37+
bio TEXT
38+
);
39+
40+
CREATE TABLE IF NOT EXISTS branch (
41+
name VARCHAR(20) PRIMARY KEY
42+
);
43+
44+
CREATE TABLE IF NOT EXISTS member_of (
45+
bmid CHAR(4) NOT NULL,
46+
bname VARCHAR(20) NOT NULL,
47+
PRIMARY KEY (bmid, bname),
48+
49+
CONSTRAINT fk_board FOREIGN KEY (bmid) REFERENCES board_member (id),
50+
CONSTRAINT fk_branch FOREIGN KEY (bname) REFERENCES branch (name)
3851
);
3952

4053
-- TODO: Create a table for access tokens for the API.

0 commit comments

Comments
 (0)