/yam-database

Yam Database

Primary LanguagePLpgSQL

Yam Database

The database for the mobile application, Yam.

This is the repo for the database skeleton that backs the mobile application Yam.

Installation

First and foremost, you must have Docker installed

These instructions should be the same for OS X & Linux & Windows

docker run -d -p 5432:5432 --name postgis-db -e POSTGRES_PASSWORD=root -d mdillon/postgis
docker exec -it postgis-db sh -c 'exec psql -U postgres'

Note: you will be prompted for the postgres password we set, which is root

From within the psql shell, run these commands to create our user and database

CREATE USER yamuser WITH password 'secret-password';
CREATE DATABASE yamdb;
\q

Now lets run the setup files to create the schema and functions

docker cp setup-files/. postgis-db:/setup-files/
docker cp setup.sql postgis-db:/setup-files/
docker exec -it postgis-db sh -c "exec psql -U postgres -d yamdb -a -f setup-files/setup.sql"

To verify that the tables were created, you may check with psql

docker exec -it postgis-db sh -c "psql -d yamdb -U yamuser"

Then run this command in the db shell to see all the tables in our schema

\dt yamschema.*

\q to quit

If there are tables at this point, congrats, you are ready to use the db

If there are no tables, please kill/restart the container and try again

Making Changes to the SQL

This command will ERASE everything thats in the Database

docker cp setup-files/. postgis-db:/setup-files/
docker cp setup.sql postgis-db:/setup-files/
docker exec -it postgis-db sh -c "exec psql -U postgres -d yamdb -a -f setup-files/setup.sql"

Release History

  • 0.0.1
    • Work in progress