avm-eac_postgresql_base0 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84e0a14809137d8b08980f06cb62e81f4ea0142bd3d7c0f3d646a906f49be832
|
4
|
+
data.tar.gz: 8e3f20b69e7af8cc0e4a1445438d0a3696c60bc8debdf9654e180a1c1f51662e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 520e4c244648f74bd1ba2f870abe3e6e3f4c58d22bf06f4c0b04e6dd926fc401f1e6d7492bfaa37c2a77d52683c85b522c4d74ed60b8824fa99823ca762885c3
|
7
|
+
data.tar.gz: 6c47c1cb2dec4acd690ce7ff7750f38f29b11c5714e2191ceff4cba4601c5da7669ed7f4c1b1058da87a0e5eecd35f2de70e841bee92032f0393ad205b3191a2
|
@@ -7,6 +7,7 @@ module Avm
|
|
7
7
|
class Instance
|
8
8
|
class DataUnit < ::Avm::Instances::Data::Unit
|
9
9
|
EXTENSION = '.pgdump.gz'
|
10
|
+
TABLES_SQL = 'select tablename from pg_tables where schemaname = \'public\''
|
10
11
|
|
11
12
|
before_load :clear_database
|
12
13
|
|
@@ -15,24 +16,29 @@ module Avm
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def load_command
|
18
|
-
instance.
|
19
|
+
instance.load_gzip_command
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
24
|
def clear_database
|
24
25
|
info 'Clearing database (Dropping all tables)...'
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"
|
26
|
+
ts = tables
|
27
|
+
if ts.empty?
|
28
|
+
info 'Database has no tables'
|
29
|
+
else
|
30
|
+
info "Removing #{ts.count} table(s)..."
|
31
|
+
run_sql('drop table ' + ts.map { |t| "\"#{t}\"" }.join(', ') + ' cascade')
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def run_sql(sql)
|
34
36
|
instance.psql_command_command(sql).execute!
|
35
37
|
end
|
38
|
+
|
39
|
+
def tables
|
40
|
+
run_sql(TABLES_SQL).each_line.map(&:strip).reject(&:blank?)
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
@@ -29,7 +29,22 @@ module Avm
|
|
29
29
|
|
30
30
|
# @return [EacRubyUtils::Envs::Command]
|
31
31
|
def dump_gzip_command
|
32
|
-
dump_command.pipe(
|
32
|
+
dump_command.pipe(gzip_compress_command)
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [EacRubyUtils::Envs::Command]
|
36
|
+
def gzip_compress_command
|
37
|
+
env.command('gzip', '-9', '-c')
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [EacRubyUtils::Envs::Command]
|
41
|
+
def gzip_decompress_command
|
42
|
+
env.command('gzip', '-d')
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [EacRubyUtils::Envs::Command]
|
46
|
+
def load_gzip_command
|
47
|
+
gzip_decompress_command.pipe(psql_command)
|
33
48
|
end
|
34
49
|
|
35
50
|
# @return [String]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-eac_postgresql_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.109'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.109'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: eac_ruby_gem_support
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|