pgmove 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pgmove/bucardo.rb +10 -1
- data/lib/pgmove/db.rb +1 -1
- data/lib/pgmove/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e8b160ec6cd5035d7929d3292c16ce847857ff
|
4
|
+
data.tar.gz: 1a94727cf4048c10ba4320633bb769c9eeed32bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8174380bd325718bc39f85907605ca8e68acab7161d0797e6346efd16783882187fe0c1f786e5fda62b8a040af9790634872c44cd9cc966073c0d5595931314a
|
7
|
+
data.tar.gz: c8c40418ddad7b569aad9beae397b7294ff7ab90f09fa1f5364740a8078d57e6d2c985b00c1744f93e9e67f4b2070408cda4a51eaf3fec78709e90def5dd7840
|
data/lib/pgmove/bucardo.rb
CHANGED
@@ -15,6 +15,7 @@ module Pgmove
|
|
15
15
|
def initialize(src_db, dest_db)
|
16
16
|
@src_db = src_db
|
17
17
|
@dest_db = dest_db
|
18
|
+
@dbname = "bucardo_#{@src_db.name}"
|
18
19
|
end
|
19
20
|
|
20
21
|
def setup
|
@@ -28,7 +29,7 @@ module Pgmove
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def bucardo(command, db: nil, env: {})
|
31
|
-
db ||=
|
32
|
+
db ||= @dbname
|
32
33
|
system! "bucardo -U #{@src_db.user} -P #{@src_db.pass} -h #{@src_db.host} -p #{@src_db.port} -d #{db} #{command}", env: env
|
33
34
|
end
|
34
35
|
|
@@ -110,12 +111,20 @@ module Pgmove
|
|
110
111
|
logger.bullet "removing bucardo"
|
111
112
|
conn.exec "DROP schema if exists bucardo cascade"
|
112
113
|
conn.exec "DROP database IF EXISTS bucardo"
|
114
|
+
conn.exec "DROP database IF EXISTS #{@dbname}"
|
113
115
|
conn.exec "drop role IF EXISTS bucardo"
|
114
116
|
end
|
115
117
|
|
116
118
|
def install
|
117
119
|
env = { "DBUSER" => @src_db.user }
|
118
120
|
bucardo "install --batch --pid-dir tmp", db: "postgres", env: env
|
121
|
+
@src_db.pg_conn do |conn|
|
122
|
+
conn.exec "alter database bucardo rename to #{@dbname}"
|
123
|
+
end
|
124
|
+
@src_db.pg_conn(@dbname) do |conn|
|
125
|
+
conn.exec "reassign owned by bucardo to #{@src_db.user}"
|
126
|
+
conn.exec "drop role bucardo"
|
127
|
+
end
|
119
128
|
end
|
120
129
|
|
121
130
|
def copy_schema
|
data/lib/pgmove/db.rb
CHANGED
data/lib/pgmove/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgmove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neeraj
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|