Skip to content

Commit

Permalink
Fix latest migration not affecting GoodJob.migrated?
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Apr 30, 2024
1 parent 2586313 commit 37f2c2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/good_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def self.deprecator
# @return [Boolean]
def self.migrated?
# Always update with the most recent migration check
GoodJob::Execution.reset_column_information
GoodJob::Execution.candidate_lookup_index_migrated?
GoodJob::DiscreteExecution.reset_column_information
GoodJob::DiscreteExecution.backtrace_migrated?
end

ActiveSupport.run_load_hooks(:good_job, self)
Expand Down
10 changes: 10 additions & 0 deletions spec/generators/good_job/update_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@
expect(normalize_schema(only_update_schema)).to eq normalize_schema(install_schema)
end

it 'has files with unique number prefixes' do
update_path = "lib/generators/good_job/templates/update/migrations"
expect(File).to exist(update_path)

migrations = Dir.glob("#{update_path}/*")
prefixes = migrations.map { |path| File.basename(path).split("_", 2).first }

expect(prefixes.map(&:to_i)).to eq(1.upto(prefixes.size).to_a)
end

def normalize_schema(text)
text.sub(/\.define\(version: ([\d_]*)\)/, '.define(version: SCHEMA_VERSION)')
end
Expand Down

0 comments on commit 37f2c2e

Please sign in to comment.