PostgreSQL

PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

Features

PostgreSQL comes with many features aimed to help developers build applications, administrators to protect data integrity and build fault-tolerant environments, and help you manage your data no matter how big or small the dataset. In addition to being free and open source, PostgreSQL is highly extensible. For example, you can define your own data types, build out custom functions, even write code from different programming languages without recompiling your database!

PostgreSQL tries to conform with the SQL standard where such conformance does not contradict traditional features or could lead to poor architectural decisions. Many of the features required by the SQL standard are supported, though sometimes with slightly differing syntax or function. Further moves towards conformance can be expected over time. As of the version 11 release in October 2018, PostgreSQL conforms to at least 160 of the 179 mandatory features for SQL:2011 Core conformance. As of this writing, no relational database meets full conformance with this standard.


Rails


Configure post gre

Create a Postgres user for the Rails app we'll create in the next step. To do this, switch into the Postgres user:

su - postgres

Then create a user (or a "role", as Postgres calls it):

create role myapp with createdb login password 'password1';
Create a new app
rails new new_app --database=postgresql

Add this gem to your Gemfile
gem 'pg'
and configure your database
development:
adapter: postgresql
encoding: unicode
database: myapp_development
pool: 5
username: myapp
password: password1

test:
adapter: postgresql
encoding: unicode
database: myapp_test
pool: 5
username: myapp
password: password1

Now you can launch
rake db:setup

This will create development and test databases, set their owners to the user specified, and create "schema_migrations" tables in each. This table is used to record your migrations to schemas and data.

rails g scaffold Post title:string body:text
rake db:migrate

and finally go to http://localhost:3000/posts