OnlineMigrations v0.4.0 Release Notes

Release Date: 2022-03-17 // about 2 years ago
    • Lazy load this gem

    • โž• Add ability to reset counter caches using background migrations

        class User < ApplicationRecord
          has_many :projects
        end
      
        class Project < ApplicationRecord
          belongs_to :user, counter_cache: true
        end
      
        class ResetUsersProjectsCount < ActiveRecord::Migration[7.0]
          def up
            reset_counters_in_background("User", :projects)
          end
        end
      
    • Accept 0 as batch_pause value for background migrations

    • 0๏ธโƒฃ Ignore default scopes in CopyColumn and BackfillColumn background migrations

    • ๐Ÿ‘ Raise an error for unsupported database versions

    • ๐Ÿ›  Fix backfilling code in suggestion for changing column's NOT NULL

    ๐Ÿ†• New safe operations

    • Changing between text and citext when not indexed
    • Changing a string column to a citext column when not indexed
    • Changing a citext column to a string column with no length limit
    • Increasing the :precision of an interval column
    • Changing a cidr column to an inet column
    • Changing an xml column to a text column
    • Changing an xml column to a string column with no :limit
    • Changing a bit column to a bit_varying column
    • Increasing or removing the :limit of a bit_varying column

    ๐Ÿ†• New unsafe operations

    • Decreasing :precision of a datetime column
    • Decreasing :limit of a timestamptz column
    • Decreasing :limit of a bit_varying column
    • โž• Adding a :limit to a bit_varying column