usps-support 0.2.28.pre.1 → 0.2.28.pre.2
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/tasks/db.rake +40 -0
- data/lib/usps/support/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 606860005bcce60a72b817299687f82fbcdb2923a8dff89d41733e4a496208db
|
|
4
|
+
data.tar.gz: 9193e802df2b32bfe6baa32a2a08e06c41ffe46a9d784d6bd4e0d393770691de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78149f6a1cb412b361cffe16ce8ef6d49c3788ff89a8878a9f64efeca175549386dc75579c47feafe0ff3b17b741b9e22ba67a7263be86e6225a4c151861b7e5
|
|
7
|
+
data.tar.gz: 9c90a3ae1b2203a4a763bfc2a270706ba0549ffc959875dfb1bf79e5c012be4e0230dfed83d579d3ad11c5bf481b03b9019f81dffbefe373afbd7a71e435c973
|
data/lib/tasks/db.rake
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
namespace :db do
|
|
4
|
+
desc "Stamp auxiliary test databases with the primary database's schema_migrations rows"
|
|
5
|
+
task stamp_auxiliary_test_schemas: :environment do
|
|
6
|
+
next unless Rails.env.test?
|
|
7
|
+
|
|
8
|
+
primary_name = ActiveRecord::Base.connection_db_config.name
|
|
9
|
+
configs = ActiveRecord::Base.configurations.configs_for(env_name: 'test')
|
|
10
|
+
primary = configs.find { |c| c.name == primary_name }
|
|
11
|
+
auxiliary = configs - [primary]
|
|
12
|
+
next if auxiliary.empty?
|
|
13
|
+
|
|
14
|
+
connection = ActiveRecord::Base.connection
|
|
15
|
+
primary_versions =
|
|
16
|
+
connection
|
|
17
|
+
.execute("SELECT version FROM #{primary.database}.schema_migrations")
|
|
18
|
+
.to_a.flatten
|
|
19
|
+
|
|
20
|
+
auxiliary.each do |config|
|
|
21
|
+
existing =
|
|
22
|
+
connection
|
|
23
|
+
.execute("SELECT version FROM #{config.database}.schema_migrations")
|
|
24
|
+
.to_a.flatten
|
|
25
|
+
|
|
26
|
+
(primary_versions - existing).each do |version|
|
|
27
|
+
puts "Stamping #{version} for #{config.database}"
|
|
28
|
+
connection.execute(
|
|
29
|
+
"INSERT INTO #{config.database}.schema_migrations (version) VALUES (#{version.to_i})"
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
%w[db:schema:load db:migrate db:test:prepare].each do |task|
|
|
37
|
+
Rake::Task[task].enhance do
|
|
38
|
+
Rake::Task['db:stamp_auxiliary_test_schemas'].invoke if Rails.env.test?
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/usps/support/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usps-support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.28.pre.
|
|
4
|
+
version: 0.2.28.pre.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
@@ -65,6 +65,7 @@ files:
|
|
|
65
65
|
- config/routes.rb
|
|
66
66
|
- db/hq/members_schema.rb
|
|
67
67
|
- db/hq/websites_schema.rb
|
|
68
|
+
- lib/tasks/db.rake
|
|
68
69
|
- lib/usps/all.rb
|
|
69
70
|
- lib/usps/support.rb
|
|
70
71
|
- lib/usps/support/db/members_schema.rb
|