avm-eac_postgresql_base0 0.2.2 → 0.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03a08a9048593955e5cc62a604c6dfc94e21abe79e995d1933a3de00b908f18a
|
4
|
+
data.tar.gz: d29c537ded1c570897830df081f2c36f5101f5e3f508392e7279e21743465709
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b5a9708048a4d3fc467db99a3960e0dca5c505fdc8e07d3933c542fe0665532f5006ba3faa8bdd3f58ae0cdeedac3bea1c210056a59e7ec45a759d9c8de69d
|
7
|
+
data.tar.gz: e3d579fc45bda1bea8666ca036989b6bd684348668edebdffb5b699add72e38e20e15a55d0b911d52d5d4fc9fdc084d3d9512fcceacb99edfe8da43353515d46
|
@@ -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 if exists ' + 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.4
|
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:
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,28 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.66'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.66.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
29
|
+
version: '0.66'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.66.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: eac_ruby_utils
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
39
|
+
version: '0.112'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
46
|
+
version: '0.112'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: eac_ruby_gem_support
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|