forked from gonzalo123/pgdbsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
68 lines (57 loc) · 1.69 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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.
The usage of pgdbsync command line script is the following one:
-c [schema]
-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