2017 © Pedro Peláez
 

library pgdbsync

pgdbsync

image

gonzalo123/pgdbsync

pgdbsync

  • Wednesday, February 10, 2016
  • by gonzalo123
  • Repository
  • 2 Watchers
  • 5 Stars
  • 132 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

pgdbsync

Build Status, (*1)

pgdbsync allows us to track the differences in the database structure between different databases. It also create the needed script to synchronize the servers and even to run the script., (*2)

The usage of pgdbsync command line script is the following one:, (*3)

 -c [config]
 -f [from database]
 -t [to database]
 -a [action: diff | summary | run]

usage examples

Summary

./pgdbsync -s web -f devel -t prod -a summary
HOST : production :: prod1
--------------------------------------------
function
 create :: WEB.hello(varchar)
tables
 create :: WEB.test
view
 create :: WEB.testview

[OK]  end process

Creating diff script

./pgdbsync -s wf -f devel -t prod -a diff
HOST : production :: prod1
--------------------------------------------
CREATE OR REPLACE FUNCTION web.hello(item character varying)
 RETURNS character varying
 LANGUAGE plpgsql
AS $function$
DECLARE
BEGIN
 return "Hi " || item;
END;
$function$

CREATE TABLE web.test(
 test_name character NOT NULL,
 test_id integer NOT NULL,
 test_date timestamp without time zone NOT NULL,
 CONSTRAINT pk_test PRIMARY KEY (test_date)
)
TABLESPACE web;
ALTER TABLE web.test OWNER TO user;

CREATE OR REPLACE VIEW web.testview AS
 SELECT test.test_name, test.test_id, test.test_date FROM web.test WHERE (test.test_name ~~ 't%'::text);;
ALTER TABLE web.testview OWNER TO user;
[OK]  end process
executing diff script
./pgdbsync -s web -f devel -t prod -a run
HOST : production :: prod1
----------------------------------

[OK]  end process
creating diff script again
./pgdbsync -s wf -f devel -t prod1 -a diff

HOST : prododuction :: prod1
--------------------------------------------

drop function web.hello(varchar);

DROP TABLE web.test;

drop view web.testview;

[OK]  end process

Notes to run tests

To run tests locally the script asumes that: - You have a PostgreSQL running at localhost (I'm using http://postgresapp.com for testing) - Two empty databases called db1 and db2 - One user to login called "username" and with password "password", (*4)

The Versions

10/02 2016

dev-master

9999999-dev

pgdbsync

  Sources   Download

MIT

db

06/01 2016

2.x-dev

2.9999999.9999999.9999999-dev

pgdbsync

  Sources   Download

MIT

db