usps-support 0.2.65 → 0.2.66

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: 1463acb74d2efd5c31800c7158d46d0cedd2f27dfd5ce7d1522cfaa97249d55c
4
- data.tar.gz: a39a0be86a6c3fa9e6132a34c4554e4e36aa9a1072ed5b800943d4bc8896fde0
3
+ metadata.gz: fe5075012e0988ba212db3443f7e168933e1477def45cfcecab1dfe20926d823
4
+ data.tar.gz: 93316be136f7099ee57549e282c8f46df57e2cf7111163f91688a962d3b6f20b
5
5
  SHA512:
6
- metadata.gz: eebc7504e070960e6671ea5aee30d0c526fe82c2c288fb6b3b54cbfe18ca4ad2a2d82ec9389d7e2dde7e50eec477b3a1dfd4eeede19c961032e8c1c6ef6e4401
7
- data.tar.gz: 300f52f53eb338646db221fd9056b9b7809a2893b6198fc7283862b59037e026588e3672ab7785571edd43c5de66e5e3a44e81c17bc866ca0c334777ed4dfa2e
6
+ metadata.gz: aa3cec6e37810a31590322d78d3a67fbe6e4fc284561616dc7023274eaaf3061db96222e1d1a8c3f8a532af5b3b95f2b2752f5cef25ef5c54e7ffbc7cef2b3c7
7
+ data.tar.gz: '09ebdb0cffb6cdedea903c65e9f3fa8fc2f2512823aad557733b121ca5a241f503e0caf16372d323071e63e2eae3f7aeb1c4cdac8c4ad83ee8e2fde8f326f847'
@@ -39,6 +39,19 @@ ActiveRecord::Schema[8.1].define do
39
39
  t.string "grade", limit: 2
40
40
  end
41
41
 
42
+ create_table "associates", primary_key: ["squadno", "certno"], charset: "latin1", comment: "dtb-Associate and Honorary Members", force: :cascade do |t|
43
+ t.integer "id", null: false, auto_increment: true
44
+ t.integer "squadno", default: 0, null: false
45
+ t.integer "dist", default: 0, null: false
46
+ t.string "certno", limit: 7, default: "", null: false
47
+ t.string "first", limit: 15
48
+ t.string "last", limit: 25
49
+ t.string "type", limit: 1
50
+ t.string "notes"
51
+ t.string "modified", limit: 6
52
+ t.index ["id"], name: "id_index"
53
+ end
54
+
42
55
  create_table "djdesc", primary_key: "jobcode", id: { type: :string, limit: 7 }, charset: "latin1", comment: "dtb-depreciated use jobcodes or djftp", force: :cascade do |t|
43
56
  t.string "jdesc", limit: 100
44
57
  t.string "rank", limit: 3, null: false
@@ -9,6 +9,9 @@ module Usps::Support::Models::Hq
9
9
  module Schemas
10
10
  SCHEMA_DIR = File.join(Usps::Support::ROOT, 'db/hq')
11
11
 
12
+ # How a host app's schema file delegates here.
13
+ DELEGATION = /\bSchemas\.load_schemas?\b/
14
+
12
15
  class << self
13
16
  # Load one or more HQ schemas into the currently-active connection.
14
17
  # Typically called from a host app's `db/<name>_schema.rb` shim so
@@ -20,6 +23,28 @@ module Usps::Support::Models::Hq
20
23
  def load_schema(name)
21
24
  load File.join(SCHEMA_DIR, "#{name}_schema.rb")
22
25
  end
26
+
27
+ # Every schema this version of the gem ships, as one string.
28
+ def shipped_source = Dir[File.join(SCHEMA_DIR, '*_schema.rb')].map { File.read(it) }.join
29
+ end
30
+
31
+ # Rails reloads a test database's schema only when the schema file's SHA1
32
+ # differs from the one recorded at its last load. A host app's file only
33
+ # delegates here, so it never changes when a gem update ships a different
34
+ # schema, and the test database would keep the old one until reloaded by
35
+ # hand. Folding the shipped schemas into a delegating file's digest makes
36
+ # `maintain_test_schema!` reload it after any such update.
37
+ module SchemaDigest
38
+ private
39
+
40
+ def schema_sha1(file)
41
+ source = File.read(file)
42
+ return super unless source.match?(DELEGATION)
43
+
44
+ OpenSSL::Digest::SHA1.hexdigest(source + Schemas.shipped_source)
45
+ end
23
46
  end
24
47
  end
25
48
  end
49
+
50
+ ActiveRecord::Tasks::DatabaseTasks.singleton_class.prepend(Usps::Support::Models::Hq::Schemas::SchemaDigest)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.2.65'
5
+ VERSION = '0.2.66'
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.65
4
+ version: 0.2.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander