This repository was archived by the owner on Jul 25, 2024. It is now read-only.
forked from NickWu007/TryLinks-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
TryLinks Database
Arcadius19 edited this page Aug 8, 2018
·
4 revisions
TryLinks consists of two databases:
-
trylinksfor storing data about tutorials, users and their progress -
linksfor auxiliary tables used in tutorials focused on links-database connections
Similarly, there are two users manipulating these databases through the software
-
trylinkshaving SELECT, INSERT, UPDATE, DELETE privileges to all tables intrylinksdatabase; connects to the DB directly from TryLinks server -
linkshaving limited access tolinksDB; connects to DB through the links config file upon the user's code compilation in tutorials
-
Login as a superuser
psql -U postgres
-
Create users. Selected passwords need to be included in
.envfile - inDB_CONNECTION_STRINGandTRYLINKS_CONFIGrespectively.CREATE USER trylinks WITH LOGIN ENCRYPTED PASSWORD '<trylinks-password>'; CREATE USER links WITH LOGIN ENCRYPTED PASSWORD '<links-password>'; -
Create databases
CREATE DATABASE trylinks; CREATE DATABASE links; -
Populate
trylinksDB withdb-init.sqlandlinksDB withdb-links-init.sql(run from bash)psql -U postgres -d trylinks -f db-init.sql psql -U postgres -d links -f db-links-init.sql
-
Grant appropriate privileges for
linksuser. Logged-in as a superuser inlinksdatabase (psql -U postgres -d links), execute:GRANT SELECT ON "factorial" to links; GRANT SELECT, INSERT, DELETE ON "todo" to links; -
Grant appropriate privileges for
trylinksuser. Logged-in as a superuser intrylinksdatabase (psql -U postgres -d trylinks), execute:GRANT SELECT, INSERT, DELETE, UPDATE ON "LinksUser","LinksTutorial","LinksFile" TO trylinks; GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO trylinks;