This repository contains SQL and corresponding scripts to setup and populate the database for BlueView
Authored by:
- William A. Zawilinski
- Joseph C. Cengel
- Richard Drum
- Anthony Chen
- Zack Allen
The latest version of Node.js > (v8.0.0) should be installed on your system. If you are using Windows and are having a hard time installing the latest version, please consider using Node Version Manager.
Clone the repository in the desired directory. Once cloned, run the following command in the root of the project directory to install the required dependencies.
npm installOn Windows, you can use installer available on the Postgres Windows Installers page. At the least, you should install the Postgres server. pgAdmin might be helpful but is not a requirement. StackBuilder is provided by the company that creates the installer; it's not necessary.
On Mac, use homebrew: brew install postgres. You can install pgAdmin separately if you wish.
On Linux, there are instructions available. There are packages for most major distributions that will be sufficient.
Once you've installed Postgres, you should be able to run the psql command from the command line.
Postgres ties into the underlying user accounts of the host operating system, so when you run psql with no other arguments, it will attempt to connect to a Postgres user with the same name as whatever username you're signed in with, and to a database with the same name.
Start the postgres prompt with some variation of
-
psql -
psql -U postgres postgres -
sudo -u postgres psql postgresdepending on the specifics of your installation. -
\qUse this to exit the prompt
Once Postgres is installed on your machine, run the following command to create the database and database user. Run this command in the root of the database directory.
psql postgres < initialize.sqlOnce the database has been created along with the user, run the following script to create the tables and populate the department data.
npm run rebuild_databaseRun the following commands to ensure the database is populated. Once the relations are there, kill the script. We realize this is not the best way to manage this and are exploring alternative modules/methods.
psql -U bv_user blueview_development Once in the sql prompt, run the following
\dtRun the following to exit the psql prompt
\qRun the following in the root directory to exit the build_script
^COnce the database has been built, run the following command in any directory to start Postgres on your machine Mac/Linux
postgres