#postgresql #change #management #tool #table #schema #dml

bin+lib pg_sync

PostgreSQL DML change management tool

4 releases (2 breaking)

0.3.0 Jul 27, 2022
0.2.0 Jul 27, 2022
0.1.4 Jul 21, 2022

#2273 in Database interfaces

Apache-2.0

140KB
663 lines

PG-Sync

PG-Sync is a PostgreSQL schema chnage management tool.

Why?

Other existing DB schema management tools deals with change sets or change set files, you dont have currunt structure of your schema in sigle place(file). Either you go through change sets or use database client tool(PG Admin).

How?

With PG-Sync you will have current database schema structure in file and PG_Sync will read your database structure and your schema file and apply diff on your database. current database schema structure = Schema if you do a fresh installation of current version of you application.


Installation

cargo install pg_sync


Examples

Example 1

CREATE TABLE table1
(
    column11 text
);

Will produce

CREATE TABLE table1
(
    column11 text
);

Example 2

CREATE TABLE table1
(
    column11 text,
    column12 text
);

Will produce

ALTER TABLE table1
    ADD COLUMN column12 text;

TODO

  • Drop old tables
  • Alter add column
  • Alter drop columns
  • Alter change column name
  • Alter change column data type
  • Alter change primary key
  • Alter change primary key with identity type

Change Log

Ver 0.3.0

  • CREATE new tables

Ver 0.2.0

  • CREATE SCHEMA

Dependencies

~18–28MB
~445K SLoC