yarn install
-
MacOS:
brew install postgres
-
Ubuntu:
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo npm install -g sequelize-cli
-
Before run and test connection, make sure you have created a database as described in the above configuration. You can use the
psql
command to create a user and database.psql postgres --u postgres
-
Next, type this command for creating a new user with password then give access for creating the database.
postgres-# CREATE ROLE admin WITH LOGIN PASSWORD 'admin_pass';
postgres-# ALTER ROLE admin CREATEDB;
-
Quit
psql
then log in again using the new user that previously created.postgres-# \q
psql postgres -U admin
-
Type this command to creating a new database.
postgres=> CREATE DATABASE sing_app_db;
-
Then give that new user privileges to the new database then quit the
psql
.postgres=> GRANT ALL PRIVILEGES ON DATABASE sing_app_db TO admin;
postgres=> \q
sequelize db:migrate && sequelize db:seed:all