Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rails 7 support #204

Merged
merged 12 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
2.7.5
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
language: ruby
rvm:
- 2.6
- 2.7
- 3.0
script: bundle exec rspec
gemfile:
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile
- gemfiles/rails_6.0.gemfile
- gemfiles/rails_6.1.gemfile
matrix:
- gemfiles/rails_7.0.gemfile
jobs:
exclude:
- rvm: 2.4.4
gemfile: gemfiles/rails_6.0.gemfile
- rvm: 2.4.4
gemfile: gemfiles/rails_6.1.gemfile
- rvm: 3.0
gemfile: gemfiles/rails_5.2.gemfile
12 changes: 4 additions & 8 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
appraise 'rails-5.0' do
gem 'rails', '5.0.7.2'
end

appraise 'rails-5.1' do
gem 'rails', '5.1.7'
end

appraise 'rails-5.2' do
gem 'rails', '~> 5.2.3'
end
Expand All @@ -17,3 +9,7 @@ end
appraise 'rails-6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails-7.0' do
gem 'rails', '~> 7.0'
end
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 8.0.0.rc1
Add support for Rails 7
Removed support for Rails versions below 5.2. Now are supported only versions Rails 5.2 and up

## 7.0.2

Remove magic comment in migration files [y-yagi](https://github.com/y-yagi)
Expand Down
7 changes: 0 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in data_migrate.gemspec
%w[
activerecord
railties
].each do |rails_gem|
gem rails_gem, '~> 6.0.0'
end
gem 'sqlite3', "~> 1.4"
gemspec
10 changes: 0 additions & 10 deletions Gemfile.rails5

This file was deleted.

10 changes: 0 additions & 10 deletions Gemfile.rails5.1

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/rails_4.1.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_4.2.gemfile

This file was deleted.

8 changes: 0 additions & 8 deletions gemfiles/rails_5.0.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/rails_5.1.gemfile → gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "http://rubygems.org"

gem "rails", "5.1.7"
gem "sqlite3", "~> 1.4"
gem "rails", "~> 7.0"

gemspec path: "../"
42 changes: 10 additions & 32 deletions lib/data_migrate.rb
Original file line number Diff line number Diff line change
@@ -1,44 +1,22 @@
# frozen_string_literal: true

if Rails::VERSION::MAJOR == 6
require File.join(File.dirname(__FILE__), "data_migrate", "data_migrator_five")
elsif Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 2
require File.join(File.dirname(__FILE__), "data_migrate", "data_migrator_five")
else
require File.join(File.dirname(__FILE__), "data_migrate", "data_migrator")
end
require File.join(File.dirname(__FILE__), "data_migrate",
"data_schema_migration")
require File.join(File.dirname(__FILE__), "data_migrate", "data_migrator_five")
require File.join(File.dirname(__FILE__), "data_migrate", "data_schema_migration")
require File.join(File.dirname(__FILE__), "data_migrate", "data_schema")
require File.join(File.dirname(__FILE__), "data_migrate", "database_tasks")
require File.join(File.dirname(__FILE__), "data_migrate", "schema_dumper")
if Rails::VERSION::MAJOR == 6
require File.join(File.dirname(__FILE__), "data_migrate", "status_service_five")
require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_six")
elsif Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 2
require File.join(File.dirname(__FILE__), "data_migrate", "status_service_five")
require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_five")
else
require File.join(File.dirname(__FILE__), "data_migrate", "status_service")
require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration")
end

if Rails::VERSION::MAJOR == 6
require File.join(File.dirname(__FILE__), "data_migrate", "migration_context")
# require File.join(File.dirname(__FILE__), "data_migrate", "migration_five")
elsif Rails::VERSION::MAJOR == 5
if Rails::VERSION::MINOR == 2
require File.join(File.dirname(__FILE__), "data_migrate", "migration_context")
else
require File.join(File.dirname(__FILE__), "data_migrate", "migration_five")
end
else
require File.join(File.dirname(__FILE__), "data_migrate", "migration")
end
require File.join(File.dirname(__FILE__), "data_migrate", "status_service_five")
require File.join(File.dirname(__FILE__), "data_migrate", "migration_context")
require File.join(File.dirname(__FILE__), "data_migrate", "railtie")
require File.join(File.dirname(__FILE__), "data_migrate", "tasks/data_migrate_tasks")
require File.join(File.dirname(__FILE__), "data_migrate", "legacy_migrator")
require File.join(File.dirname(__FILE__), "data_migrate", "config")

if Rails::VERSION::MAJOR == 5
require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_five")
else
require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_six")
end

module DataMigrate
end
101 changes: 0 additions & 101 deletions lib/data_migrate/data_migrator.rb

This file was deleted.

14 changes: 14 additions & 0 deletions lib/data_migrate/database_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ def dump_filename(namespace, format = ActiveRecord::Base.schema_format)
ENV["DATA_SCHEMA"] || File.join(schema_location, filename)
end

def schema_dump_path(db_config, format = ActiveRecord.schema_format)
return ENV["DATA_SCHEMA"] if ENV["DATA_SCHEMA"]

filename = if db_config.primary?
schema_file_type(format)
else
[db_config.name, schema_file_type(format)].join("_")
end

return unless filename

File.dirname(filename) == schema_location ? filename : File.join(schema_location, filename)
end

def schema_location
db_dir
end
Expand Down
26 changes: 0 additions & 26 deletions lib/data_migrate/migration.rb

This file was deleted.

26 changes: 0 additions & 26 deletions lib/data_migrate/migration_five.rb

This file was deleted.

31 changes: 0 additions & 31 deletions lib/data_migrate/schema_migration.rb

This file was deleted.

Loading