rails-data-migrations 1.2.0 → 1.3.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 +4 -4
 - data/.github/workflows/checkstyle.yml +34 -0
 - data/.github/workflows/test.yml +53 -0
 - data/.gitignore +1 -0
 - data/.rubocop.yml +27 -1
 - data/Appraisals +43 -20
 - data/Gemfile +2 -0
 - data/README.md +2 -1
 - data/Rakefile +2 -0
 - data/lib/active_record/data_migration.rb +2 -0
 - data/lib/generators/data_migration_generator.rb +3 -1
 - data/lib/generators/templates/data_migration_generator.rb +2 -0
 - data/lib/rails-data-migrations.rb +2 -2
 - data/lib/rails_data_migrations/log_entry.rb +27 -6
 - data/lib/rails_data_migrations/migrator.rb +21 -3
 - data/lib/rails_data_migrations/railtie.rb +2 -0
 - data/lib/rails_data_migrations/version.rb +3 -1
 - data/lib/tasks/data_migrations.rake +5 -1
 - data/rails-data-migrations.gemspec +5 -5
 - metadata +14 -55
 - data/.travis.yml +0 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 81e0b46ee1de39f2886005424fe92edf73f00bd0eff85ab897609275446faa3b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8ad2ee73f8fbfecbe5f3ad0eee390bb2585f33d08fbdc8599d0d90a694da6fe0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e6601d3a3337fb9e3d15c854bb91eec58ad2665260615eadf4bbddc8b03123f7dc755c9a2a64e7ce8c82d9c132c8821ab5386013e30d45e4da386b540c7e7368
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: dcc120a18ff836d3f6ea0149e3c9ca3c1ae820473b70e95a5e7f80393741581f05bbefee8fd55a3b94baa39974daf4b2404a028a8043592ccad2b96fd85e5db2
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: Rubocop
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            on:
         
     | 
| 
      
 4 
     | 
    
         
            +
              push:
         
     | 
| 
      
 5 
     | 
    
         
            +
                branches:
         
     | 
| 
      
 6 
     | 
    
         
            +
                  - "*"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              pull_request:
         
     | 
| 
      
 9 
     | 
    
         
            +
                branches:
         
     | 
| 
      
 10 
     | 
    
         
            +
                  - master
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 13 
     | 
    
         
            +
              rubocop:
         
     | 
| 
      
 14 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 17 
     | 
    
         
            +
                  - name: Cancel previous runs
         
     | 
| 
      
 18 
     | 
    
         
            +
                    uses: styfle/cancel-workflow-action@0.12.1
         
     | 
| 
      
 19 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 20 
     | 
    
         
            +
                      access_token: ${{ github.token }}
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  - uses: actions/checkout@v4
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  - name: Set up Ruby ${{ matrix.ruby-version }}
         
     | 
| 
      
 25 
     | 
    
         
            +
                    uses: ruby/setup-ruby@v1
         
     | 
| 
      
 26 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 27 
     | 
    
         
            +
                      ruby-version: 3.2
         
     | 
| 
      
 28 
     | 
    
         
            +
                      bundler-cache: true
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  - name: Install rubocop
         
     | 
| 
      
 31 
     | 
    
         
            +
                    run: gem install rubocop -v "~>1.63"
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  - name: Run rubocop
         
     | 
| 
      
 34 
     | 
    
         
            +
                    run: rubocop --parallel --fail-level R
         
     | 
| 
         @@ -0,0 +1,53 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: Test
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            on:
         
     | 
| 
      
 4 
     | 
    
         
            +
              push:
         
     | 
| 
      
 5 
     | 
    
         
            +
                branches:
         
     | 
| 
      
 6 
     | 
    
         
            +
                  - "*"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              pull_request:
         
     | 
| 
      
 9 
     | 
    
         
            +
                branches:
         
     | 
| 
      
 10 
     | 
    
         
            +
                  - master
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 13 
     | 
    
         
            +
              test:
         
     | 
| 
      
 14 
     | 
    
         
            +
                name: Test
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                timeout-minutes: 15
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 21 
     | 
    
         
            +
                  fail-fast: false
         
     | 
| 
      
 22 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 23 
     | 
    
         
            +
                    ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3]
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - name: Cancel previous runs
         
     | 
| 
      
 27 
     | 
    
         
            +
                    uses: styfle/cancel-workflow-action@0.12.1
         
     | 
| 
      
 28 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 29 
     | 
    
         
            +
                      access_token: ${{ github.token }}
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  - uses: actions/checkout@v4
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  - name: Set up Ruby ${{ matrix.ruby-version }}
         
     | 
| 
      
 34 
     | 
    
         
            +
                    uses: ruby/setup-ruby@v1
         
     | 
| 
      
 35 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 36 
     | 
    
         
            +
                      ruby-version: ${{ matrix.ruby-version }}
         
     | 
| 
      
 37 
     | 
    
         
            +
                      bundler: 1
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  - uses: actions/cache@v4
         
     | 
| 
      
 40 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 41 
     | 
    
         
            +
                      path: vendor/bundle
         
     | 
| 
      
 42 
     | 
    
         
            +
                      key: ${{ runner.os }}-bundle-${{ matrix.ruby-version }}-v3-${{ hashFiles('rails-data-migrations.gemspec', 'Appraisals') }}
         
     | 
| 
      
 43 
     | 
    
         
            +
                      restore-keys: |
         
     | 
| 
      
 44 
     | 
    
         
            +
                        ${{ runner.os }}-bundle-${{ matrix.ruby-version }}-v3-
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                  - name: Install dependencies
         
     | 
| 
      
 47 
     | 
    
         
            +
                    run: |
         
     | 
| 
      
 48 
     | 
    
         
            +
                      bundle config path vendor/bundle
         
     | 
| 
      
 49 
     | 
    
         
            +
                      bundle install --jobs 4 --retry 3
         
     | 
| 
      
 50 
     | 
    
         
            +
                      bundle exec appraisal install --path vendor/bundle
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                  - name: Run tests
         
     | 
| 
      
 53 
     | 
    
         
            +
                    run: bundle exec appraisal rake
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -1,10 +1,36 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            AllCops:
         
     | 
| 
      
 2 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 3 
     | 
    
         
            +
                - 'vendor/**/*'
         
     | 
| 
      
 4 
     | 
    
         
            +
                - 'gemfiles/**/*'
         
     | 
| 
      
 5 
     | 
    
         
            +
              TargetRubyVersion: 2.7
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Gemspec/RequiredRubyVersion:
         
     | 
| 
       2 
8 
     | 
    
         
             
              Enabled: false
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Layout/TrailingEmptyLines:
         
     | 
| 
      
 11 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Metrics/AbcSize:
         
     | 
| 
      
 14 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       3 
16 
     | 
    
         
             
            Metrics/BlockLength:
         
     | 
| 
       4 
17 
     | 
    
         
             
              Enabled: false
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       5 
19 
     | 
    
         
             
            Metrics/LineLength:
         
     | 
| 
       6 
20 
     | 
    
         
             
              Max: 120
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Metrics/MethodLength:
         
     | 
| 
      
 23 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            Naming/FileName:
         
     | 
| 
      
 26 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - lib/rails-data-migrations.rb
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       7 
29 
     | 
    
         
             
            Style/Documentation:
         
     | 
| 
       8 
30 
     | 
    
         
             
              Enabled: false
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            Style/HashSyntax:
         
     | 
| 
      
 33 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       9 
35 
     | 
    
         
             
            Style/NumericLiterals:
         
     | 
| 
       10 
36 
     | 
    
         
             
              Enabled: false
         
     | 
    
        data/Appraisals
    CHANGED
    
    | 
         @@ -1,31 +1,54 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
              gem 'rails', '4.0.13'
         
     | 
| 
       3 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
       4 
2 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              gem 'rails', '~> 4.1.0'
         
     | 
| 
       7 
     | 
    
         
            -
            end
         
     | 
| 
      
 3 
     | 
    
         
            +
            ruby_version = Gem::Version.new(RUBY_VERSION)
         
     | 
| 
       8 
4 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
      
 5 
     | 
    
         
            +
            if ruby_version < Gem::Version.new('2.7.0')
         
     | 
| 
      
 6 
     | 
    
         
            +
              ['4.0.0', '4.1.0', '4.2.0'].each do |rails_version|
         
     | 
| 
      
 7 
     | 
    
         
            +
                appraise "rails-#{rails_version}" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  gem 'rails', "~> #{rails_version}"
         
     | 
| 
      
 9 
     | 
    
         
            +
                  gem 'bigdecimal', '1.3.5'
         
     | 
| 
      
 10 
     | 
    
         
            +
                  gem 'sqlite3', '~> 1.3.6'
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
       11 
13 
     | 
    
         
             
            end
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
            if ruby_version < Gem::Version.new('3.0.0')
         
     | 
| 
      
 16 
     | 
    
         
            +
              appraise 'rails-5.0' do
         
     | 
| 
      
 17 
     | 
    
         
            +
                gem 'rails', '~> 5.0.0'
         
     | 
| 
      
 18 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.3.6'
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            appraise 'rails-5. 
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
              appraise 'rails-5.1' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                gem 'rails', '~> 5.1.0'
         
     | 
| 
      
 23 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.3.6'
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
       20 
25 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
            appraise 'rails-5. 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
              appraise 'rails-5.2' do
         
     | 
| 
      
 27 
     | 
    
         
            +
                gem 'rails', '~> 5.2.0'
         
     | 
| 
      
 28 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.3.6'
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
       23 
30 
     | 
    
         
             
            end
         
     | 
| 
       24 
31 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
               
     | 
| 
      
 32 
     | 
    
         
            +
            if ruby_version >= Gem::Version.new('2.5.0')
         
     | 
| 
      
 33 
     | 
    
         
            +
              appraise 'rails-6.0' do
         
     | 
| 
      
 34 
     | 
    
         
            +
                gem 'rails', '~> 6.0.0'
         
     | 
| 
      
 35 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.4.0'
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              appraise 'rails-6.1' do
         
     | 
| 
      
 39 
     | 
    
         
            +
                gem 'rails', '~> 6.1.0'
         
     | 
| 
      
 40 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.4.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
       27 
42 
     | 
    
         
             
            end
         
     | 
| 
       28 
43 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
      
 44 
     | 
    
         
            +
            if ruby_version >= Gem::Version.new('2.7.0')
         
     | 
| 
      
 45 
     | 
    
         
            +
              appraise 'rails-7.0' do
         
     | 
| 
      
 46 
     | 
    
         
            +
                gem 'rails', '~> 7.0.0'
         
     | 
| 
      
 47 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.4.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              appraise 'rails-7.1' do
         
     | 
| 
      
 51 
     | 
    
         
            +
                gem 'rails', '~> 7.1.0'
         
     | 
| 
      
 52 
     | 
    
         
            +
                gem 'sqlite3', '~> 1.4.0'
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
       31 
54 
     | 
    
         
             
            end
         
     | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Rails Data Migrations
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            [](https://github.com/anjlab/rails-data-migrations/actions/workflows/test.yml)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://github.com/anjlab/rails-data-migrations/actions/workflows/checkstyle.yml)
         
     | 
| 
       4 
5 
     | 
    
         
             
            [](https://badge.fury.io/rb/rails-data-migrations)
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            ## Why?
         
     | 
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -1,8 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            require 'rails/generators'
         
     | 
| 
       2 
4 
     | 
    
         
             
            require 'rails-data-migrations'
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
       4 
6 
     | 
    
         
             
            class DataMigrationGenerator < Rails::Generators::NamedBase
         
     | 
| 
       5 
     | 
    
         
            -
              source_root File.expand_path(' 
     | 
| 
      
 7 
     | 
    
         
            +
              source_root File.expand_path('templates', __dir__)
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
              def create_migration_file
         
     | 
| 
       8 
10 
     | 
    
         
             
                migration_file_name =
         
     | 
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            require 'rails'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'active_record'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'active_record/data_migration'
         
     | 
| 
         @@ -6,4 +7,3 @@ require 'rails_data_migrations/version' 
     | 
|
| 
       6 
7 
     | 
    
         
             
            require 'rails_data_migrations/log_entry'
         
     | 
| 
       7 
8 
     | 
    
         
             
            require 'rails_data_migrations/migrator'
         
     | 
| 
       8 
9 
     | 
    
         
             
            require 'rails_data_migrations/railtie'
         
     | 
| 
       9 
     | 
    
         
            -
            # rubocop:enable Naming/FileName
         
     | 
| 
         @@ -1,12 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module RailsDataMigrations
         
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
                   
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              module SharedMethods
         
     | 
| 
      
 5 
     | 
    
         
            +
                def table_name
         
     | 
| 
      
 6 
     | 
    
         
            +
                  "#{ActiveRecord::Base.table_name_prefix}data_migrations#{ActiveRecord::Base.table_name_suffix}"
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def index_name
         
     | 
| 
      
 10 
     | 
    
         
            +
                  "#{table_name_prefix}unique_data_migrations#{table_name_suffix}"
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              if Gem::Version.new('7.1.0') >= Gem::Version.new(::ActiveRecord.version)
         
     | 
| 
      
 15 
     | 
    
         
            +
                class LogEntry < ::ActiveRecord::SchemaMigration
         
     | 
| 
      
 16 
     | 
    
         
            +
                  class << self
         
     | 
| 
      
 17 
     | 
    
         
            +
                    include SharedMethods
         
     | 
| 
       6 
18 
     | 
    
         
             
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              else
         
     | 
| 
      
 21 
     | 
    
         
            +
                class LogEntry < ::ActiveRecord::Base
         
     | 
| 
      
 22 
     | 
    
         
            +
                  class << self
         
     | 
| 
      
 23 
     | 
    
         
            +
                    include SharedMethods
         
     | 
| 
      
 24 
     | 
    
         
            +
                    def create_table
         
     | 
| 
      
 25 
     | 
    
         
            +
                      ::ActiveRecord::SchemaMigration.define_method(:table_name) do
         
     | 
| 
      
 26 
     | 
    
         
            +
                        "#{::ActiveRecord::Base.table_name_prefix}data_migrations#{::ActiveRecord::Base.table_name_suffix}"
         
     | 
| 
      
 27 
     | 
    
         
            +
                      end
         
     | 
| 
       7 
28 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                     
     | 
| 
      
 29 
     | 
    
         
            +
                      ::ActiveRecord::Base.connection.schema_migration.create_table
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
       10 
31 
     | 
    
         
             
                  end
         
     | 
| 
       11 
32 
     | 
    
         
             
                end
         
     | 
| 
       12 
33 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module RailsDataMigrations
         
     | 
| 
       2 
4 
     | 
    
         
             
              class Migrator < ::ActiveRecord::Migrator
         
     | 
| 
       3 
5 
     | 
    
         
             
                MIGRATOR_SALT = 2053462855
         
     | 
| 
         @@ -46,8 +48,16 @@ module RailsDataMigrations 
     | 
|
| 
       46 
48 
     | 
    
         
             
                    Rails::VERSION::MAJOR > 5 || (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 2)
         
     | 
| 
       47 
49 
     | 
    
         
             
                  end
         
     | 
| 
       48 
50 
     | 
    
         | 
| 
      
 51 
     | 
    
         
            +
                  def rails_7_1?
         
     | 
| 
      
 52 
     | 
    
         
            +
                    Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR >= 1
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       49 
55 
     | 
    
         
             
                  def list_migrations
         
     | 
| 
       50 
     | 
    
         
            -
                    if  
     | 
| 
      
 56 
     | 
    
         
            +
                    if rails_7_1?
         
     | 
| 
      
 57 
     | 
    
         
            +
                      ::ActiveRecord::MigrationContext.new(
         
     | 
| 
      
 58 
     | 
    
         
            +
                        migrations_path, ::ActiveRecord::Base.connection.schema_migration
         
     | 
| 
      
 59 
     | 
    
         
            +
                      ).migrations
         
     | 
| 
      
 60 
     | 
    
         
            +
                    elsif rails_6_0?
         
     | 
| 
       51 
61 
     | 
    
         
             
                      ::ActiveRecord::MigrationContext.new(migrations_path, ::ActiveRecord::SchemaMigration).migrations
         
     | 
| 
       52 
62 
     | 
    
         
             
                    elsif rails_5_2?
         
     | 
| 
       53 
63 
     | 
    
         
             
                      ::ActiveRecord::MigrationContext.new(migrations_path).migrations
         
     | 
| 
         @@ -61,12 +71,20 @@ module RailsDataMigrations 
     | 
|
| 
       61 
71 
     | 
    
         
             
                      already_migrated = get_all_versions
         
     | 
| 
       62 
72 
     | 
    
         
             
                      list_migrations.reject { |m| already_migrated.include?(m.version) }
         
     | 
| 
       63 
73 
     | 
    
         
             
                    else
         
     | 
| 
       64 
     | 
    
         
            -
                      open(migrations_path).pending_migrations
         
     | 
| 
      
 74 
     | 
    
         
            +
                      open(migrations_path).pending_migrations # rubocop:disable Security/Open
         
     | 
| 
       65 
75 
     | 
    
         
             
                    end
         
     | 
| 
       66 
76 
     | 
    
         
             
                  end
         
     | 
| 
       67 
77 
     | 
    
         | 
| 
       68 
78 
     | 
    
         
             
                  def run_migration(direction, migrations_path, version)
         
     | 
| 
       69 
     | 
    
         
            -
                    if  
     | 
| 
      
 79 
     | 
    
         
            +
                    if rails_7_1?
         
     | 
| 
      
 80 
     | 
    
         
            +
                      new(
         
     | 
| 
      
 81 
     | 
    
         
            +
                        direction,
         
     | 
| 
      
 82 
     | 
    
         
            +
                        list_migrations,
         
     | 
| 
      
 83 
     | 
    
         
            +
                        ::ActiveRecord::Base.connection.schema_migration,
         
     | 
| 
      
 84 
     | 
    
         
            +
                        ::ActiveRecord::InternalMetadata.new(ActiveRecord::Base.connection),
         
     | 
| 
      
 85 
     | 
    
         
            +
                        version
         
     | 
| 
      
 86 
     | 
    
         
            +
                      ).run
         
     | 
| 
      
 87 
     | 
    
         
            +
                    elsif rails_6_0?
         
     | 
| 
       70 
88 
     | 
    
         
             
                      new(direction, list_migrations, ::ActiveRecord::SchemaMigration, version).run
         
     | 
| 
       71 
89 
     | 
    
         
             
                    elsif rails_5_2?
         
     | 
| 
       72 
90 
     | 
    
         
             
                      new(direction, list_migrations, version).run
         
     | 
| 
         @@ -1,8 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            require 'rake'
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            namespace :data do
         
     | 
| 
       4 
6 
     | 
    
         
             
              def apply_single_migration(direction, version)
         
     | 
| 
       5 
7 
     | 
    
         
             
                raise 'VERSION is required' unless version
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       6 
9 
     | 
    
         
             
                RailsDataMigrations::Migrator.run_migration(
         
     | 
| 
       7 
10 
     | 
    
         
             
                  direction,
         
     | 
| 
       8 
11 
     | 
    
         
             
                  RailsDataMigrations::Migrator.migrations_path,
         
     | 
| 
         @@ -42,7 +45,8 @@ namespace :data do 
     | 
|
| 
       42 
45 
     | 
    
         
             
                desc 'Skip single data migration using VERSION'
         
     | 
| 
       43 
46 
     | 
    
         
             
                task skip: :init_migration do
         
     | 
| 
       44 
47 
     | 
    
         
             
                  version = ENV['VERSION'].to_i
         
     | 
| 
       45 
     | 
    
         
            -
                  raise 'VERSION is required' unless version 
     | 
| 
      
 48 
     | 
    
         
            +
                  raise 'VERSION is required' unless version.positive?
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       46 
50 
     | 
    
         
             
                  if RailsDataMigrations::LogEntry.where(version: version).any?
         
     | 
| 
       47 
51 
     | 
    
         
             
                    puts "data migration #{version} was already applied."
         
     | 
| 
       48 
52 
     | 
    
         
             
                  else
         
     | 
| 
         @@ -1,4 +1,6 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            lib = File.expand_path('lib', __dir__)
         
     | 
| 
       2 
4 
     | 
    
         
             
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
       3 
5 
     | 
    
         
             
            require 'rails_data_migrations/version'
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
         @@ -17,13 +19,11 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       17 
19 
     | 
    
         
             
              end
         
     | 
| 
       18 
20 
     | 
    
         
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       19 
21 
     | 
    
         
             
              spec.require_paths = ['lib']
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.required_ruby_version = '>= 2.3'
         
     | 
| 
       20 
23 
     | 
    
         | 
| 
       21 
24 
     | 
    
         
             
              spec.add_runtime_dependency 'rails', '>= 4.0.0'
         
     | 
| 
       22 
25 
     | 
    
         | 
| 
       23 
26 
     | 
    
         
             
              spec.add_development_dependency 'appraisal', '~> 2.1'
         
     | 
| 
       24 
     | 
    
         
            -
              spec.add_development_dependency ' 
     | 
| 
       25 
     | 
    
         
            -
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '>= 12.3.3'
         
     | 
| 
       26 
28 
     | 
    
         
             
              spec.add_development_dependency 'rspec', '3.5.0'
         
     | 
| 
       27 
     | 
    
         
            -
              spec.add_development_dependency 'rubocop', '0.52.1'
         
     | 
| 
       28 
     | 
    
         
            -
              spec.add_development_dependency 'sqlite3', '~> 1.3'
         
     | 
| 
       29 
29 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rails-data-migrations
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Sergey Glukhov
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-05-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -38,34 +38,20 @@ dependencies: 
     | 
|
| 
       38 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
40 
     | 
    
         
             
                    version: '2.1'
         
     | 
| 
       41 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
     | 
    
         
            -
              name: bundler
         
     | 
| 
       43 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
     | 
    
         
            -
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       46 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: '1.13'
         
     | 
| 
       48 
     | 
    
         
            -
              type: :development
         
     | 
| 
       49 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       50 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
     | 
    
         
            -
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       53 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: '1.13'
         
     | 
| 
       55 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
42 
     | 
    
         
             
              name: rake
         
     | 
| 
       57 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - " 
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       60 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version:  
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 12.3.3
         
     | 
| 
       62 
48 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
     | 
    
         
            -
                - - " 
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       67 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version:  
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 12.3.3
         
     | 
| 
       69 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
56 
     | 
    
         
             
              name: rspec
         
     | 
| 
       71 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -80,45 +66,18 @@ dependencies: 
     | 
|
| 
       80 
66 
     | 
    
         
             
                - - '='
         
     | 
| 
       81 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
68 
     | 
    
         
             
                    version: 3.5.0
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
              name: rubocop
         
     | 
| 
       85 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       86 
     | 
    
         
            -
                requirements:
         
     | 
| 
       87 
     | 
    
         
            -
                - - '='
         
     | 
| 
       88 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       89 
     | 
    
         
            -
                    version: 0.52.1
         
     | 
| 
       90 
     | 
    
         
            -
              type: :development
         
     | 
| 
       91 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       92 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       93 
     | 
    
         
            -
                requirements:
         
     | 
| 
       94 
     | 
    
         
            -
                - - '='
         
     | 
| 
       95 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       96 
     | 
    
         
            -
                    version: 0.52.1
         
     | 
| 
       97 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       98 
     | 
    
         
            -
              name: sqlite3
         
     | 
| 
       99 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       100 
     | 
    
         
            -
                requirements:
         
     | 
| 
       101 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       102 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       103 
     | 
    
         
            -
                    version: '1.3'
         
     | 
| 
       104 
     | 
    
         
            -
              type: :development
         
     | 
| 
       105 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       106 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       107 
     | 
    
         
            -
                requirements:
         
     | 
| 
       108 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       109 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
     | 
    
         
            -
                    version: '1.3'
         
     | 
| 
       111 
     | 
    
         
            -
            description: 
         
     | 
| 
      
 69 
     | 
    
         
            +
            description:
         
     | 
| 
       112 
70 
     | 
    
         
             
            email:
         
     | 
| 
       113 
71 
     | 
    
         
             
            - sergey.glukhov@gmail.com
         
     | 
| 
       114 
72 
     | 
    
         
             
            executables: []
         
     | 
| 
       115 
73 
     | 
    
         
             
            extensions: []
         
     | 
| 
       116 
74 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       117 
75 
     | 
    
         
             
            files:
         
     | 
| 
      
 76 
     | 
    
         
            +
            - ".github/workflows/checkstyle.yml"
         
     | 
| 
      
 77 
     | 
    
         
            +
            - ".github/workflows/test.yml"
         
     | 
| 
       118 
78 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       119 
79 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
       120 
80 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
       121 
     | 
    
         
            -
            - ".travis.yml"
         
     | 
| 
       122 
81 
     | 
    
         
             
            - Appraisals
         
     | 
| 
       123 
82 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       124 
83 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
         @@ -138,7 +97,7 @@ homepage: https://github.com/OffgridElectric/rails-data-migrations 
     | 
|
| 
       138 
97 
     | 
    
         
             
            licenses:
         
     | 
| 
       139 
98 
     | 
    
         
             
            - MIT
         
     | 
| 
       140 
99 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       141 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 100 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       142 
101 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       143 
102 
     | 
    
         
             
            require_paths:
         
     | 
| 
       144 
103 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -146,15 +105,15 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       146 
105 
     | 
    
         
             
              requirements:
         
     | 
| 
       147 
106 
     | 
    
         
             
              - - ">="
         
     | 
| 
       148 
107 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       149 
     | 
    
         
            -
                  version: ' 
     | 
| 
      
 108 
     | 
    
         
            +
                  version: '2.3'
         
     | 
| 
       150 
109 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       151 
110 
     | 
    
         
             
              requirements:
         
     | 
| 
       152 
111 
     | 
    
         
             
              - - ">="
         
     | 
| 
       153 
112 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       154 
113 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       155 
114 
     | 
    
         
             
            requirements: []
         
     | 
| 
       156 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       157 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 115 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
      
 116 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       158 
117 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       159 
118 
     | 
    
         
             
            summary: Run your data migration tasks in a db:migrate-like manner
         
     | 
| 
       160 
119 
     | 
    
         
             
            test_files: []
         
     |