Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

rnx-pgdiff

Rednaxel PostgreSQL Diff Tool

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

rnx-pgdiff - PostgreSQL diff tool

This tool connects to two databases (master and slave), reverse-engineer their database structures and, when used with the --exec parameter, executes DDL commands on the slave to make them equal.

DDL commands supported:

  • CREATE TABLE ...
  • ALTER TABLE ... ADD COLUMN
  • ALTER TABLE ... ADD CONSTRAINT
  • DROP/CREATE TRIGGER ...
  • CREATE OR REPLACE FUNCTION ...
  • CREATE OR REPLACE VIEW ...

Syntax:

pascal
-- Rednaxel PostgreSQL Diff Tool - v1.12
Syntax: rnx_pg_diff -m IP [options]
  -m IP, --master=IP    Master server IP address.
  -l IP, --local=IP     Slave server IP address (default=localhost).
Options:
  -u, --username        Username.
  -p, --password        Password.
  -d, --database        Database (default=username).
  -s, --schema          Schema (default=public).
  -h, --help            Prints this message.
  -q, --queries         Prints internal SQL queries.
  -v, --verbose         Prints detailed output.
  -x, --exec            Executes the DDL commands on slave.

Example 1: Linux server, slave = localhost, using .pgpass to omit password

pascal
$ ./rnx_pg_diff -m 192.168.1.10 -u rednaxel -d rnge3 -s rnx -v

Example 2: Windows workstation, requires slave IP and password

pascal
.\rnx_pg_diff.exe --local=192.168.1.12 -m 192.168.1.10 -p mypassword -u rednaxel -d rnge3 -s rnx -v