-
Notifications
You must be signed in to change notification settings - Fork 3
Configuring PostgreSQL Tables
Isaac List edited this page Apr 30, 2022
·
4 revisions
The following Bash script will configure the PostgreSQL tables expected by the application.
#!/bin/bash
# Enter heroku's psql shell and recreate tables
heroku pg:psql
create table floorspreus ( shelves json NOT NULL, floor int NOT NULL, mincode varchar(8) NOT NULL ) ;
create table booklist IF NOT EXISTS (
isbn VARCHAR(16),
author VARCHAR(64),
title VARCHAR(256),
call_no VARCHAR(48),
username VARCHAR(64),
PRIMARY KEY (isbn, username)
);
\qIf setting up a database on your own machine, consider the following alternative script:
#!/bin/bash
# Enter local psql shell and recreate tables (requires sudo access)
sudo -u postgres psql
create table floorspreus ( shelves json NOT NULL, floor int NOT NULL, mincode varchar(8) NOT NULL ) ;
create table booklist IF NOT EXISTS (
isbn VARCHAR(16) PRIMARY KEY,
author VARCHAR(64),
title VARCHAR(256),
call_no VARCHAR(48),
username VARCHAR(64),
PRIMARY KEY (isbn, username)
);
\q