dbagent 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/db_agent/db_handler/postgresql.rb +1 -1
- data/lib/db_agent/seeder.rb +17 -0
- data/lib/db_agent/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c2b984695e5b3a5ad9914d854aac93782909e3036f6da4c3e03c85090db4e6
|
4
|
+
data.tar.gz: 1ff73e5297b062b206c3d6424b99609ac23977e58089717be6ef8d90d179e5e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0a628f347c26ce920876054f88abdd342370fc5c4297182b46e7aa6d4ff4ca3ac629f8be33894634ba311b8155839f6ae6dd33a23bb90634e54cd91f64583a2
|
7
|
+
data.tar.gz: eb596cdf028b0243d7c1e3852cd47daf8be4c3471117baa386bb96367653902920394822a264e9b797d3bf689eed608eab771321b666d8715b5d70565798029f
|
data/lib/db_agent/seeder.rb
CHANGED
@@ -8,6 +8,8 @@ module DbAgent
|
|
8
8
|
|
9
9
|
def install(from)
|
10
10
|
handler.sequel_db.transaction do
|
11
|
+
before_seeding!
|
12
|
+
|
11
13
|
folder = handler.data_folder/from
|
12
14
|
|
13
15
|
# load files in order
|
@@ -26,6 +28,8 @@ module DbAgent
|
|
26
28
|
file = pairs[name]
|
27
29
|
handler.sequel_db[name.to_sym].multi_insert(file.load)
|
28
30
|
end
|
31
|
+
|
32
|
+
after_seeding!(folder)
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
@@ -86,6 +90,19 @@ module DbAgent
|
|
86
90
|
|
87
91
|
private
|
88
92
|
|
93
|
+
def before_seeding!
|
94
|
+
file = handler.data_folder/"before_seeding.sql"
|
95
|
+
return unless file.exists?
|
96
|
+
|
97
|
+
handler.sequel_db.execute(file.read)
|
98
|
+
end
|
99
|
+
|
100
|
+
def after_seeding!(folder)
|
101
|
+
file = folder/"after_seeding.sql"
|
102
|
+
handler.sequel_db.execute(file.read) if file.exists?
|
103
|
+
after_seeding!(folder.parent) unless folder == handler.data_folder
|
104
|
+
end
|
105
|
+
|
89
106
|
def merged_data(from)
|
90
107
|
folder = handler.data_folder/from
|
91
108
|
data = {}
|
data/lib/db_agent/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbagent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.1.4
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: A tool to migrate, spy and seed relational databases.
|