Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions backend/db/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
CREATE TABLE user_info (
id BIGSERIAL NOT NULL PRIMARY KEY,
name VARCHAR(50) NOT NULL,
age SMALLINT NOT NULL CHECK(age > 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to dob.

year SMALLINT NOT NULL CHECK(year IN (1,2,3,4)),
branch VARCHAR(50) NOT NULL CHECK(branch IN ('CSE','ECE','MECH','SM','BDES')),
bio VARCHAR(500),
image VARCHAR(200),
public_key VARCHAR(500) NOT NULL
);

CREATE TABLE tags_table (
id BIGSERIAL NOT NULL PRIMARY KEY,
name VARCHAR(50) NOT NULL
);

CREATE TABLE tags_user_table (
tag_id BIGINT NOT NULL REFERENCES tags_table(id),
user_id BIGINT NOT NULL REFERENCES user_info(id)
);

CREATE TABLE choices_for_chooser (
chooser_id BIGINT NOT NULL REFERENCES user_info(id),
chosen_id BIGINT REFERENCES user_info(id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this value will be encrypted make it a varchar and it won't reference anything

UNIQUE (chooser_id)
);

CREATE TABLE choices_for_chosen (
chosen_id BIGINT NOT NULL REFERENCES user_info(id),
chooser_id BIGINT REFERENCES user_info(id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here the value will be encrypted make it a varchar and it won't reference anything

UNIQUE (chosen_id)
);