que 2.1.0 → 2.2.0

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: '08d50e63c19dbe61966e4048eb1e30fce181e520b05f20f933220baede9cbc76'
4
- data.tar.gz: 72abbb3390310c18897739e35a2fdb5e6a8187a9b5ae27e4ee651ce4b7c8d9bf
3
+ metadata.gz: fd8e2e7b77de787218a646c550cf38fddd52091c91422fdb5813b12fe1af775c
4
+ data.tar.gz: e9abc8a607b82db9b0ed925163ed4b21d61f7f2588b1dfd91bf8b558af3fa14c
5
5
  SHA512:
6
- metadata.gz: aa542178d30c1fc031ae2508ff462d0b1ff23f2e5a4e6f9b3fb1cb08ec3ac3a3cc6c167e532654124b5d72c53a319c0b74c3f3a2eb0b5e66102242b43ad59a50
7
- data.tar.gz: d3902890b359a759f9fe3c94f431afb512e312b6dc46d22223d0d3dc7154f21458a8c7592a72850318094af3c4bfe59950dc8f5bde68e314911695e39d19507a
6
+ metadata.gz: 55cea89090a9685c5001aba97794e0fa2246362da2b530b02808966e3a4487d07a908ec980d141ad76d59bd04065863fbc097af2ea78acefda110dfdb37cea48
7
+ data.tar.gz: 114317905799b63fcc9b4c5180a15f24da03e7937790e6b330d0d67c5a0d7df062c470dd2b8a98426f5ced795b5da6d435a647e9504b66ba669fb72953872f66
data/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  <!-- MarkdownTOC autolink=true -->
4
4
 
5
+ - [2.2.0 \(2022-08-29\)](#220-2022-08-29)
5
6
  - [2.1.0 \(2022-08-25\)](#210-2022-08-25)
6
7
  - [2.0.0 \(2022-08-25\)](#200-2022-08-25)
7
8
  - [1.4.1 \(2022-07-24\)](#141-2022-07-24)
@@ -55,6 +56,20 @@
55
56
 
56
57
  <!-- /MarkdownTOC -->
57
58
 
59
+ ## 2.2.0 (2022-08-29)
60
+
61
+ - **Changed**:
62
+ + When migrating, now raises an exception when the Que DB schema version is missing from the database. The migrations system records this version in a comment on the `que_jobs` table. [#379](https://github.com/que-rb/que/pull/379)
63
+ * > Que::Error: Cannot determine Que DB schema version.
64
+ >
65
+ > The que_jobs table is missing its comment recording the Que DB schema version. This is likely due to a bug in Rails schema dump in Rails 7 versions prior to 7.0.3, omitting comments - see https://github.com/que-rb/que/issues/363. Please determine the appropriate schema version from your migrations and record it manually by running the following SQL (replacing version as appropriate):
66
+ >
67
+ > COMMENT ON TABLE que_jobs IS 'version';
68
+ - **Removed**:
69
+ + Removed support for upgrading directly from a version of Que prior to v0.5.0 (released on 2014-01-14), which introduced the migrations system. It's too difficult to handle the different DB schemas from prior to this.
70
+ - **Internal**:
71
+ + Moved `command_line_interface.rb` from `bin/` to `lib/`. [#378](https://github.com/que-rb/que/pull/378)
72
+
58
73
  ## 2.1.0 (2022-08-25)
59
74
 
60
75
  - **Added**:
@@ -65,7 +80,7 @@
65
80
  This release contains a database migration. You will need to migrate Que to the latest database schema version (7). For example, on ActiveRecord and Rails 6:
66
81
 
67
82
  ```ruby
68
- class UpdateQueTablesToVersion6 < ActiveRecord::Migration[6.0]
83
+ class UpdateQueTablesToVersion7 < ActiveRecord::Migration[6.0]
69
84
  def up
70
85
  Que.migrate!(version: 7)
71
86
  end
data/bin/que CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'command_line_interface'
4
+ require 'que/command_line_interface'
5
5
 
6
6
  $stdout.sync = true
7
7
 
File without changes
@@ -48,14 +48,27 @@ module Que
48
48
  # No table in the database at all.
49
49
  0
50
50
  elsif (d = result.first[:description]).nil?
51
- # There's a table, it was just created before the migration system
52
- # existed.
53
- 1
51
+ # The table exists but the version comment is missing
52
+ _raise_db_version_comment_missing_error
54
53
  else
55
54
  d.to_i
56
55
  end
57
56
  end
58
57
 
58
+ # The que_jobs table could be missing the schema version comment either due to:
59
+ # - Being created before the migration system existed; or
60
+ # - A bug in Rails schema dump in some versions of Rails
61
+ # The former is the case on Que versions prior to v0.5.0 (2014-01-14). Upgrading directly from there is unsupported, so we just raise in all cases of the comment being missing
62
+ def _raise_db_version_comment_missing_error
63
+ raise Error, <<~ERROR
64
+ Cannot determine Que DB schema version.
65
+
66
+ The que_jobs table is missing its comment recording the Que DB schema version. This is likely due to a bug in Rails schema dump in Rails 7 versions prior to 7.0.3, omitting comments - see https://github.com/que-rb/que/issues/363. Please determine the appropriate schema version from your migrations and record it manually by running the following SQL (replacing version as appropriate):
67
+
68
+ COMMENT ON TABLE que_jobs IS 'version';
69
+ ERROR
70
+ end
71
+
59
72
  def set_db_version(version)
60
73
  i = version.to_i
61
74
  Que.execute "COMMENT ON TABLE que_jobs IS '#{i}'" unless i.zero?
data/lib/que/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Que
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
 
6
6
  def self.job_schema_version
7
7
  2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: que
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hanks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2022-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,7 +45,6 @@ files:
45
45
  - auto/psql
46
46
  - auto/test
47
47
  - auto/test-postgres-14
48
- - bin/command_line_interface.rb
49
48
  - bin/que
50
49
  - docker-compose.yml
51
50
  - docs/README.md
@@ -53,6 +52,7 @@ files:
53
52
  - lib/que/active_job/extensions.rb
54
53
  - lib/que/active_record/connection.rb
55
54
  - lib/que/active_record/model.rb
55
+ - lib/que/command_line_interface.rb
56
56
  - lib/que/connection.rb
57
57
  - lib/que/connection_pool.rb
58
58
  - lib/que/job.rb