I've local PostgreSQL database with tables, constraints, relations etc.
How can I migrate it to a production server?
From pg_dump manual page you can try with pg_dump and psql, you can also check other flags for data, schema or table specific tasks. I personally sometime do this kind of job using Navicat or pgAdmin client.
To dump a database called mydb into a SQL-script file:
$ pg_dump mydb > db.sql
To reload such a script into a (freshly created) database named newdb:
$ psql -d newdb -f db.sql
Try using flyway. It does exactly this. Dump your schema into an sql file and migrate using flyway.
pg_dump: server version: 9.6.5; pg_dump version: 9.5.10pg_dump: aborting because of server version mismatchliquibaseorflywayis good approach, but I'am at the end of developing my app. These tools must be used from the start of developing an app (put each sql script into file and store them )locate bin/pg_dumpto find pg_dump for 9.6 version