Skip to content

Commit

Permalink
Backport #281
Browse files Browse the repository at this point in the history
  • Loading branch information
ngan committed Aug 2, 2023
1 parent 7bc28b8 commit f092853
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/data_migrate/database_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def schema_file_type(_format = nil)
"data_schema.rb"
end

# This method is removed in Rails 7.0
def dump_filename(spec_name, format = ActiveRecord::Base.schema_format)
filename = if spec_name == "primary"
schema_file_type(format)
Expand Down Expand Up @@ -73,14 +74,14 @@ def schema_dump_path(db_config, format = ActiveRecord.schema_format)
# We only require a schema.rb file for the primary database
return unless db_config.primary?

super.gsub(/(_)?schema\.rb\z/, '\1data_schema.rb')
File.join(File.dirname(ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(db_config, format)), schema_file_type)
end

# Override this method from `ActiveRecord::Tasks::DatabaseTasks`
# to ensure that the sha saved in ar_internal_metadata table
# is from the original schema.rb file
def schema_sha1(file)
super(file.gsub(/data_schema.rb\z/, 'schema.rb'))
ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env, name: "primary"))
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/data_migrate/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DataMigrate
VERSION = "9.1.0".freeze
VERSION = "9.1.1".freeze
end
1 change: 0 additions & 1 deletion spec/data_migrate/database_tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
end

describe :forward do

it "run forward default amount of times" do
subject.forward
versions = DataMigrate::DataSchemaMigration.normalized_versions
Expand Down

0 comments on commit f092853

Please sign in to comment.