Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
S4a021 Web Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charlie Darques
S4a021 Web Backend
Commits
3e7c1db4
Commit
3e7c1db4
authored
1 month ago
by
Charlie Darques
Browse files
Options
Downloads
Patches
Plain Diff
correction sql
parent
ba3d095a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sql/createTables.sql
+21
-7
21 additions, 7 deletions
sql/createTables.sql
with
21 additions
and
7 deletions
sql/createTables.sql
+
21
−
7
View file @
3e7c1db4
...
...
@@ -15,32 +15,46 @@ CREATE TABLE msg (
threadID
int
,
msg
text
,
posted_at
DATE
,
CONSTRAINT
fk_message
FOREIGN
KEY
(
userID_msg
)
REFERENCES
userAccount
(
userID
),
CONSTRAINT
fk_message
FOREIGN
KEY
(
userID_msg
)
REFERENCES
userAccount
(
userID
)
ON
DELETE
CASCADE
,
CONSTRAINT
pk_message
PRIMARY
KEY
(
msgID
)
);
CREATE
TABLE
thread
(
threadID
SERIAL
,
userID_thread
int
,
threadName
VARCHAR
(
50
),
CONSTRAINT
fk_thread
FOREIGN
KEY
(
userID_thread
)
REFERENCES
userAccount
(
userID
),
CONSTRAINT
pk_thread
PRIMARY
KEY
(
threadID
)
CONSTRAINT
fk_thread
FOREIGN
KEY
(
userID_thread
)
REFERENCES
userAccount
(
userID
)
ON
DELETE
CASCADE
,
CONSTRAINT
pk_thread
PRIMARY
KEY
(
threadID
)
);
CREATE
TABLE
reactions
(
userID_reactions
int
,
msgID_reactions
int
,
reaction
boolean
,
CONSTRAINT
fk_reactions_user
FOREIGN
KEY
(
userID_reactions
)
REFERENCES
userAccount
(
userID
),
CONSTRAINT
fk_reactions_message
FOREIGN
KEY
(
msgID_reactions
)
REFERENCES
msg
(
msgID
),
CONSTRAINT
fk_reactions_user
FOREIGN
KEY
(
userID_reactions
)
REFERENCES
userAccount
(
userID
)
ON
DELETE
CASCADE
,
CONSTRAINT
fk_reactions_message
FOREIGN
KEY
(
msgID_reactions
)
REFERENCES
msg
(
msgID
)
ON
DELETE
CASCADE
,
CONSTRAINT
pk_reactions
PRIMARY
KEY
(
userID_reactions
,
msgID_reactions
)
);
CREATE
TABLE
follow
(
userID_follow
int
,
threadID_follow
int
,
followDate
date
,
CONSTRAINT
fk_follow_user
FOREIGN
KEY
(
userID_follow
)
REFERENCES
userAccount
(
userID
),
CONSTRAINT
fk_follow_thread
FOREIGN
KEY
(
threadID_follow
)
REFERENCES
thread
(
threadID
),
CONSTRAINT
fk_follow_user
FOREIGN
KEY
(
userID_follow
)
REFERENCES
userAccount
(
userID
)
ON
DELETE
CASCADE
,
CONSTRAINT
fk_follow_thread
FOREIGN
KEY
(
threadID_follow
)
REFERENCES
thread
(
threadID
)
ON
DELETE
CASCADE
,
CONSTRAINT
pk_follow
PRIMARY
KEY
(
userID_follow
,
threadID_follow
)
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment