DDL_COMPARE(1) General Commands Manual DDL_COMPARE(1)

ddl_comparecompare PostgreSQL schemas

ddl_compare [-v] [-g globals] [-n schema] a.sql b.sql

The ddl_compare utility applies schema files to ephemeral instances of PostgreSQL created by pg_tmp(1) and generates an representation dependencies for table that can be easily compared using a visual editor such as vimdiff(1). The results are written to directories _a and _b in the current directory. The arguments are as follows:

Display the URL of each ephemeral database
Apply a series of SQL statements to both sides before generating a schema diff.
Name the schema that to be compared. The default is ‘public’.

The positional arguments are supplied as the filename to psql(1), so it is also possible to substitute a hyphen (‘-’) and supply the database definition on standard input.

The path to an file containing SQL functions for extracting a schema for each table. The default is /usr/share/misc/ddlx${MAJOR}.sql.

Find the differences between a test instance and a schema definition

pg_dump -s $dev_url > /tmp/dev_dump.sql
ddl_compare -g roles.sql localharvest.sql /tmp/dev_dump.sql


October 1, 2020 OpenBSD 6.8