From 3bb749d9ae9bbd8f04c593c2adcb204f9f9723ea Mon Sep 17 00:00:00 2001 From: Adrien Rey-Jarthon Date: Tue, 19 Nov 2024 11:23:31 +0100 Subject: [PATCH] Allow Mongoid 9.0.3+ now that the client override isolation bug has been fixed and released (v1.6.1) --- .github/workflows/test.yaml | 2 +- README.md | 31 ++++++++++++++++++------- lib/mongoid_rails_migrations/version.rb | 2 +- mongoid_rails_migrations.gemspec | 3 ++- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 197c806..ea59aff 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,7 +12,7 @@ jobs: gemfile: - rails6-mongoid7 - rails7-mongoid8 - # - rails7-mongoid9 + - rails7-mongoid9 include: - ruby_version: '2.4' gemfile: rails5-mongoid6 diff --git a/README.md b/README.md index 2c02ca2..c797f40 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ gem "mongoid_rails_migrations" ``` Create migration -``` +```console $ rails generate mongoid:migration ``` Run migrations: -``` +```console $ rails db:migrate $ rails db:migrate:down VERSION= $ rails db:migrate:up VERSION= @@ -25,14 +25,14 @@ $ rails db:version ``` If you want to use output migration use the hook `after_migrate` -``` +```ruby Mongoid::Migration.after_migrate = ->(output, name, direction, crash) { upload_to_s3(name, output, direction) if crash == false } ``` To override the default migrations path (`db/migrate`), add the following line to your `application.rb` file: -``` +```ruby Mongoid::Migrator.migrations_path = ['foo/bar/db/migrate', 'path/to/db/migrate'] ``` @@ -42,7 +42,7 @@ Default behavior is to store migrations in the `default` client database but for To generate a migration that can be run on shards, suffix the migration generator command with `--shards` like: -``` +```console $ rails generate mongoid:migration --shards ``` @@ -69,7 +69,7 @@ production: In order to manage a sharded migration, run tasks with the `MONGOID_CLIENT_NAME` environment variable: -``` +```console $ rails db:migrate MONGOID_CLIENT_NAME=shard2 ``` @@ -98,7 +98,12 @@ Global migrations can still be created with the `--no-shards` option. ## Unreleased -[Compare master with 1.6.0](https://github.com/adacosta/mongoid_rails_migrations/compare/v1.6.0...master) +[Compare master with 1.6.1](https://github.com/adacosta/mongoid_rails_migrations/compare/v1.6.1...master) + +## 1.6.1 +_19/11/2024_ +* Allow Mongoid 9.0.3+ now that the client override isolation bug has been fixed and released: https://jira.mongodb.org/browse/MONGOID-5815 +* Add testing gemfile for Rails 7 + Mongoid 9 to the matrix ## 1.6.0 _12/09/2024_ @@ -139,10 +144,20 @@ _18/08/2015_ # Tests -``` +```console +$ bundle install $ bundle exec rake ``` +Test a specific rails/mongoid version gemfile: + +```console +$ BUNDLE_GEMFILE=gemfiles/rails8-mongoid9 bundle install +$ BUNDLE_GEMFILE=gemfiles/rails8-mongoid9 bundle exec rake +``` + +Note: if you already ran the command a while ago, you can use `bundle update` instead of `bundle install` to fetch latest compatible versions. + # Credits to * rails diff --git a/lib/mongoid_rails_migrations/version.rb b/lib/mongoid_rails_migrations/version.rb index b04d3b8..caa8827 100644 --- a/lib/mongoid_rails_migrations/version.rb +++ b/lib/mongoid_rails_migrations/version.rb @@ -1,3 +1,3 @@ module MongoidRailsMigrations #:nodoc: - VERSION = '1.6.0' + VERSION = '1.6.1' end diff --git a/mongoid_rails_migrations.gemspec b/mongoid_rails_migrations.gemspec index f001fb5..dcaf429 100644 --- a/mongoid_rails_migrations.gemspec +++ b/mongoid_rails_migrations.gemspec @@ -20,7 +20,8 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency('bundler', '>= 1.0.0') # 9.0.0 broke client override isolation: https://jira.mongodb.org/browse/MONGOID-5815 - spec.add_runtime_dependency('mongoid', '>= 5.0.0', '< 9.0.0') + # got fixed in 9.0.3 so rejectings versions in between to prevent bad surprises: + spec.add_runtime_dependency('mongoid', '>= 5.0.0', '!= 9.0.0', '!= 9.0.1', '!= 9.0.2') spec.add_runtime_dependency('rails', rails_version) spec.add_runtime_dependency('railties', rails_version) spec.add_runtime_dependency('activesupport', rails_version)