PostgreSQL
Introductionβ
PostgreSQL is a powerful, open source object-relational database system that has earned it a strong reputation for reliability, feature robustness, and performance.
Installationβ
How to Installed PostgreSQL.
With Ubuntuβ
Run into the Terminal π:
sudo apt install postgresql
With Windowsβ
Installing Database Server:
Client PostgreSQL Installation pgAdmin.
Clientβ
To run management commands lines into the database server, you will need to connect to PostgreSQL.
Ubuntuβ
Run into the terminal the below command line:
sudo -u postgres psql
Windowsβ
Use and Install pgAdmin.
Create an Userβ
Run the following command line that is conneted to the Client PostgreSQL:
create user app_user with password 'S3cR3t';
Building a Databaseβ
For this step the user will need to run the below command line that is conneted to the client PostgreSQL:
create database app_db with owner app_user;
To Exit use the command line:
\q
Database Set upβ
Using the client app PostgreSQL, you can also connect yourself to the new database that you built.
Ubuntuβ
Run the below line command into the terminal:
sudo -u postgres psql app_db
Windowsβ
Use and Install pgAdmin.
UUID Extension and Installationβ
Is required to install into PostgreSQL an extension to generate UUID.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Application Set upβ
You must edit the configuration file of the application according to the environment:
config/_development.json
PostgreSQL example and Configuration:
{
...
"db": {
"default": {
"engine": "pg",
"port": "5432",
"host": "localhost",
"name": "app_db",
"username": "app_user",
"password": "S3cR3t"
}
},
...
}
Also can be used advanced setups as you can see below π:
{
...
"db": {
"default": {
"engine": "pg",
"port": "5432",
"host": "localhost",
"name": "app_db",
"username": "app_user",
"password": "S3cR3t",
"maximumPoolSize": 100,
"minimumIdle": 1,
"idleTimeout": 10000,
"maxLifetime": 60000
}
},
...
}