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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83e0e0288076dfd0fd510b52e780c7a34c9e8de1ffdc1d9108b8d681830f01b0
4
- data.tar.gz: 904ab0958ad02a32cc7544a82c9e7572fca476a8a2792e80e2dd68e4ea48c230
3
+ metadata.gz: f4c2b984695e5b3a5ad9914d854aac93782909e3036f6da4c3e03c85090db4e6
4
+ data.tar.gz: 1ff73e5297b062b206c3d6424b99609ac23977e58089717be6ef8d90d179e5e0
5
5
  SHA512:
6
- metadata.gz: c561e5bb29b6f0feca4e82c2df7b2e2ddfb96ce9c2ca6d7493170c78d064022f62d21c3f1740c56d0d39ef57488cb22579cb61283751cbc12a6ef488f54d9886
7
- data.tar.gz: 8146448e9a5390c822dadec4036f94bca80124a58d16086b4397188396254dd5533f46dec8d7db350b40ec111491b7b89afe2184d6b13bd271899c6ffb38092d
6
+ metadata.gz: b0a628f347c26ce920876054f88abdd342370fc5c4297182b46e7aa6d4ff4ca3ac629f8be33894634ba311b8155839f6ae6dd33a23bb90634e54cd91f64583a2
7
+ data.tar.gz: eb596cdf028b0243d7c1e3852cd47daf8be4c3471117baa386bb96367653902920394822a264e9b797d3bf689eed608eab771321b666d8715b5d70565798029f
@@ -63,4 +63,4 @@ module DbAgent
63
63
  end
64
64
  end # class PostgreSQL
65
65
  end # module DbHandler
66
- end # module DbAgent
66
+ end # module DbAgent
@@ -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 = {}
@@ -1,6 +1,6 @@
1
1
  module DbAgent
2
2
 
3
3
  # Current version of DbAgent
4
- VERSION = "3.0.1"
4
+ VERSION = "3.1.0"
5
5
 
6
6
  end
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.1
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-08-24 00:00:00.000000000 Z
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.0.8
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.