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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charlie Darques
S4a021 Web Backend
Commits
786236e9
Commit
786236e9
authored
6 months ago
by
Charlie Darques
Browse files
Options
Downloads
Patches
Plain Diff
script création des tables
parent
6a5c0f4b
Branches
main
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
createTables.sql
+43
-0
43 additions, 0 deletions
createTables.sql
with
43 additions
and
0 deletions
createTables.sql
0 → 100644
+
43
−
0
View file @
786236e9
DROP
TABLE
IF
EXISTS
userAccount
,
msg
,
thread
,
reactions
,
follow
CASCADE
;
CREATE
TABLE
userAccount
(
userID
SERIAL
,
username
VARCHAR
(
50
),
password
VARCHAR
(
20
),
CONSTRAINT
pk_user
PRIMARY
KEY
(
userID
)
);
CREATE
TABLE
msg
(
msgID
SERIAL
,
userID_msg
int
,
threadID
int
,
msg
text
,
CONSTRAINT
fk_message
FOREIGN
KEY
(
userID_msg
)
REFERENCES
userAccount
(
userID
),
CONSTRAINT
pk_message
PRIMARY
KEY
(
msgID
)
);
CREATE
TABLE
thread
(
userID_thread
int
,
threadID
SERIAL
,
threadName
VARCHAR
(
50
),
CONSTRAINT
fk_thread
FOREIGN
KEY
(
userID_thread
)
REFERENCES
userAccount
(
userID
),
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
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
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