que-schema 0.1.4 → 0.1.6
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/CHANGELOG.md +5 -5
- data/Gemfile.lock +1 -1
- data/lib/que_schema/schema_dumper.rb +11 -0
- data/lib/que_schema/schema_statements.rb +0 -1
- data/lib/que_schema/version.rb +1 -1
- data/spec/integration_spec.rb +23 -0
- data/spec/schema_dumper_spec.rb +35 -6
- data/spec/schema_statements_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71e681ea559a1c058ea2910f9dd669ac22500079b19f8cad80cc8ea9c9108de7
|
|
4
|
+
data.tar.gz: 88c4a69dd7d108cfd0350b8c139c1ba3eca6b441bc51350be533e081339dda72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69245623ab1e91c6038acb67db62f17c6501143b1bc5e81889a9800f4d2e582794a058f8dfcabcc942483fbaf799f2eaf207c7f7a5e2a6a8ce2f7948fa6a6564
|
|
7
|
+
data.tar.gz: c1ee2e54d132b2696436e338f69106ae4d95849cc9f86350e132c7e3706a526f978093332ba57a2aae7901eed5894747a297998af22b4df4d8bd180ee76539bd
|
data/CHANGELOG.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
## [0.1.
|
|
5
|
+
## [0.1.6] - 2026-06-15
|
|
6
6
|
|
|
7
7
|
### Fixed
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Schema dump no longer leaves stray blank lines where Que tables are suppressed (d99d5a7)
|
|
10
10
|
|
|
11
|
-
## [0.1.
|
|
11
|
+
## [0.1.5] - 2026-04-22
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Fixed
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- reenqueue_scheduler_if_missing no longer fires during db:schema:load (853d664)
|
data/Gemfile.lock
CHANGED
|
@@ -18,6 +18,17 @@ module QueSchema
|
|
|
18
18
|
super
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
# Exclude Que-managed tables from the dump. #table also guards against
|
|
22
|
+
# emitting their body, but ActiveRecord::SchemaDumper#tables emits an
|
|
23
|
+
# inter-table separator blank line for every entry in its list — so a
|
|
24
|
+
# table merely blanked by #table still leaves a stray blank line behind.
|
|
25
|
+
# Filtering here, before the list is built, keeps the output clean.
|
|
26
|
+
def ignored?(table_name)
|
|
27
|
+
return true if postgresql? && que_table?(table_name)
|
|
28
|
+
|
|
29
|
+
super
|
|
30
|
+
end
|
|
31
|
+
|
|
21
32
|
# Suppress Que-managed tables — Que.migrate! recreates them during
|
|
22
33
|
# schema load via que_define_schema.
|
|
23
34
|
def table(table_name, stream)
|
data/lib/que_schema/version.rb
CHANGED
data/spec/integration_spec.rb
CHANGED
|
@@ -74,4 +74,27 @@ RSpec.describe "QueSchema integration (round-trip)" do
|
|
|
74
74
|
count = conn.execute("SELECT count(*) AS cnt FROM que_jobs")
|
|
75
75
|
expect((count.first["cnt"] || count.first[:cnt]).to_i).to eq(1)
|
|
76
76
|
end
|
|
77
|
+
|
|
78
|
+
it "does not leave stray blank lines where suppressed Que tables sort" do
|
|
79
|
+
c = conn
|
|
80
|
+
schema_context = Object.new.extend(QueSchema::SchemaStatements)
|
|
81
|
+
schema_context.define_singleton_method(:connection) { c }
|
|
82
|
+
schema_context.que_define_schema(version: 7)
|
|
83
|
+
|
|
84
|
+
# App tables bracketing the que_* tables alphabetically, so any separator
|
|
85
|
+
# left behind by a suppressed Que table lands between real tables.
|
|
86
|
+
conn.create_table(:apples, force: true) { |t| t.string :name }
|
|
87
|
+
conn.create_table(:zebras, force: true) { |t| t.string :name }
|
|
88
|
+
|
|
89
|
+
stream = StringIO.new
|
|
90
|
+
ActiveRecord::SchemaDumper.dump(pool, stream)
|
|
91
|
+
schema_rb = stream.string
|
|
92
|
+
|
|
93
|
+
# Rails separates tables with exactly one blank line. A suppressed table
|
|
94
|
+
# must not leave its inter-table separator behind as consecutive blanks.
|
|
95
|
+
expect(schema_rb).not_to match(/\n[ \t]*\n[ \t]*\n/)
|
|
96
|
+
ensure
|
|
97
|
+
conn.drop_table(:apples, if_exists: true)
|
|
98
|
+
conn.drop_table(:zebras, if_exists: true)
|
|
99
|
+
end
|
|
77
100
|
end
|
data/spec/schema_dumper_spec.rb
CHANGED
|
@@ -26,7 +26,11 @@ RSpec.describe QueSchema::SchemaDumper do
|
|
|
26
26
|
stream.puts " end"
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
def ignored?(table_name)
|
|
30
|
+
false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private :tables, :table, :ignored?
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
|
|
@@ -146,6 +150,31 @@ RSpec.describe QueSchema::SchemaDumper do
|
|
|
146
150
|
end
|
|
147
151
|
end
|
|
148
152
|
|
|
153
|
+
describe "#ignored?" do
|
|
154
|
+
context "when PostgreSQL" do
|
|
155
|
+
before { stub_postgresql! }
|
|
156
|
+
|
|
157
|
+
it "ignores Que-managed tables so they leave no separator behind" do
|
|
158
|
+
expect(dumper.send(:ignored?, "que_jobs")).to be true
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it "delegates non-que tables to super" do
|
|
162
|
+
expect(dumper.send(:ignored?, "users")).to be false
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
context "when not PostgreSQL" do
|
|
167
|
+
before do
|
|
168
|
+
allow(connection).to receive(:adapter_name).and_return("SQLite")
|
|
169
|
+
allow(connection).to receive(:respond_to?).with(:adapter_name).and_return(true)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
it "does not ignore que_* tables" do
|
|
173
|
+
expect(dumper.send(:ignored?, "que_jobs")).to be false
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
149
178
|
describe "#foreign_keys" do
|
|
150
179
|
context "when PostgreSQL" do
|
|
151
180
|
before { stub_postgresql! }
|
|
@@ -191,9 +220,9 @@ RSpec.describe QueSchema::SchemaDumper do
|
|
|
191
220
|
end
|
|
192
221
|
|
|
193
222
|
describe "#functions (private)" do
|
|
194
|
-
let(:que_fn) { double("function", name: "que_job_notify", to_schema:
|
|
195
|
-
let(:app_fn) { double("function", name: "my_app_function", to_schema:
|
|
196
|
-
let(:scheduler_fn) { double("function", name: "que_scheduler_check_job_exists", to_schema:
|
|
223
|
+
let(:que_fn) { double("function", name: "que_job_notify", to_schema: " create_function :que_job_notify") }
|
|
224
|
+
let(:app_fn) { double("function", name: "my_app_function", to_schema: " create_function :my_app_function") }
|
|
225
|
+
let(:scheduler_fn) { double("function", name: "que_scheduler_check_job_exists", to_schema: " create_function :que_scheduler_check_job_exists") }
|
|
197
226
|
|
|
198
227
|
before do
|
|
199
228
|
stub_postgresql!
|
|
@@ -212,8 +241,8 @@ RSpec.describe QueSchema::SchemaDumper do
|
|
|
212
241
|
end
|
|
213
242
|
|
|
214
243
|
describe "#triggers (private)" do
|
|
215
|
-
let(:que_trigger) { double("trigger", name: "que_job_notify", to_schema:
|
|
216
|
-
let(:app_trigger) { double("trigger", name: "que_scheduler_prevent_job_deletion_trigger", to_schema:
|
|
244
|
+
let(:que_trigger) { double("trigger", name: "que_job_notify", to_schema: " create_trigger :que_job_notify") }
|
|
245
|
+
let(:app_trigger) { double("trigger", name: "que_scheduler_prevent_job_deletion_trigger", to_schema: " create_trigger :que_scheduler_prevent_job_deletion_trigger") }
|
|
217
246
|
|
|
218
247
|
before do
|
|
219
248
|
stub_postgresql!
|
|
@@ -90,10 +90,10 @@ RSpec.describe QueSchema::SchemaStatements do
|
|
|
90
90
|
expect(Que::Scheduler::Migrations.migrate_called_with).to eq(8)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
it "
|
|
93
|
+
it "does not call reenqueue_scheduler_if_missing during schema load" do
|
|
94
94
|
instance.que_define_schema(version: 7)
|
|
95
95
|
|
|
96
|
-
expect(Que::Scheduler::Migrations.reenqueue_called).to
|
|
96
|
+
expect(Que::Scheduler::Migrations.reenqueue_called).to be_nil
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: que-schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jim Gay
|
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
103
|
version: '0'
|
|
104
104
|
requirements: []
|
|
105
|
-
rubygems_version: 4.0.
|
|
105
|
+
rubygems_version: 4.0.10
|
|
106
106
|
specification_version: 4
|
|
107
107
|
summary: Enables schema.rb compatibility for the que job queue gem
|
|
108
108
|
test_files: []
|