This repository has been 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:
-
trylinks
for storing data about tutorials, users and their progress -
links
for auxiliary tables used in tutorials focused on links-database connections
Similarly, there are two users manipulating these databases through the software
-
trylinks
having SELECT, INSERT, UPDATE, DELETE privileges to all tables intrylinks
database; connects to the DB directly from TryLinks server -
links
having limited access tolinks
DB; 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
.env
file - inDB_CONNECTION_STRING
andTRYLINKS_CONFIG
respectively.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
trylinks
DB withdb-init.sql
andlinks
DB 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
links
user. Logged-in as a superuser inlinks
database (psql -U postgres -d links
), execute:GRANT SELECT ON "factorial" to links; GRANT SELECT, INSERT, DELETE ON "todo" to links;
-
Grant appropriate privileges for
trylinks
user. Logged-in as a superuser intrylinks
database (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;