1 - install postgres locally
brew install postgresql
2 - create database zakazDB
initdb <path>/zakazDB
3 - start database
pg_ctl -D <path>/zakazDB start
4 - connect to postgres db and setup up roles and new db for our app
psql postgres
CREATE DATABASE "zakaz-dev";
CREATE ROLE admin WITH PASSWORD 'admin123';
ALTER USER admin WITH SUPERUSER CREATEDB CREATEROLE LOGIN BYPASSRLS REPLICATION;
GRANT CONNECT ON DATABASE "zakaz-dev" TO admin;
5 - connect as the new user
psql -U admin -d zakaz-dev -W
CREATE TABLE user (
id SERIAL NOT NULL PRIMARY KEY,
firstName varchar(16),
lastName varchar(16),
phoneNumber INT,
password varchar(256),
dateCreated TIMESTAMPTZ NOT NULL DEFAULT NOW (),
lastUpdated varchar(32),
lastLogin varchar(32),
gender varchar(8),
userType varchar(16),
birthDate varchar(32)
);