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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '068c46f84709d2141a241efc9d6e8a1fc232ef1e7552696fa4ab4e9f449967fb'
4
- data.tar.gz: f392bbaa7f05ef68c4cde9f3f833761a6c16619d5ffce0a5deb777a1edf6dc7f
3
+ metadata.gz: 606860005bcce60a72b817299687f82fbcdb2923a8dff89d41733e4a496208db
4
+ data.tar.gz: 9193e802df2b32bfe6baa32a2a08e06c41ffe46a9d784d6bd4e0d393770691de
5
5
  SHA512:
6
- metadata.gz: 20ac03931ea956c7cf85ae5e385c29e6042cc13361e786a4ecdb724cf434329ce6335a5d2308a724e0e003fa49f089f481b94232d236b87e15a145ac17e47197
7
- data.tar.gz: cf4aaf8db11fcef84542f10f46966729a7219b51a3c158232f9943c7e10a2a037365f2dd1b2ba7107cf2687237c2d21243da15988a08679ef7c59ef475ae1cd3
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.2.28-1'
5
+ VERSION = '0.2.28-2'
6
6
  end
7
7
  end
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.1
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