Skip to content

mstill3/database-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Database Playground

Notes

  • All software I ask you to install is free for non-business use
  • I organized the directories in the following way
    • bin/ contains the executable shell scripts
    • docs/ contains the additional documentation files (they end in .md)
    • res/ contains the additional resources like image files
    • src/ contains the SQL files
      • migrations/ contains the initialized on startup database SQL commands
      • scripts/ contains the on-the-fly, ad-hoc SQL commands

Pre-requisites

  1. Install docker
  2. Only If you are running on Windows OS
    1. Install git
    2. For all the following commands use the git bash terminal since it supports running scripts ending in .sh

Instructions

  1. Ensure docker is running

    • You should see a little whale in the taskbar
      whale symbol image
    • You may have to search for and run docker in your installed local applications
    • (Optional) You can check if docker is running from the following command
      docker ps
      • if you see an error that includes Cannot connect to the Docker daemon, then docker is not running locally
  2. Run the database docker container

    ./bin/start_db.sh
  3. Check the status of the database docker container

    • From the Docker Desktop application docker desktop image
    • OR from the following command in the terminal
      docker ps
      docker ps start command image
  4. Once running, you can now connect to the database at localhost:5432

    • The database info can all be changed in the bin/start_db.sh file under the Set local variables comment.
    • The current database settings are:
      • HOST = localhost
      • PORT = 5432
      • DB_NAME = postgres
      • USERNAME = postgres
      • PASSWORD = password
  5. (Optional) To connect to the local database there are the following applications you can use

    • BeeKeeper
      • Connecting to local DB connecting in beekeeper
      • Viewing data inside DB data in beekeeper
  6. (Optional) To stop & remove the database docker container run

    ./bin/remove_db.sh

    docker ps remove command image

  7. (Optional) If you want to make changes to the initialization of the database (src/migrations/*.sh), you will need to restart the database docker container

    ./bin/start_db.sh
  8. (Optional) For a command line interface into the database container

    ./bin/enter_db.sh

    cli for postgres

Relevant Documentation

About

dockerized postgres database to mess around with

Topics

Resources

Stars

Watchers

Forks

Languages