Skip to content

Commit

Permalink
Allow Mongoid 9.0.3+ now that the client override isolation bug has b…
Browse files Browse the repository at this point in the history
…een fixed and released (v1.6.1)
  • Loading branch information
jarthod committed Nov 19, 2024
1 parent a00eea1 commit 3bb749d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
gemfile:
- rails6-mongoid7
- rails7-mongoid8
# - rails7-mongoid9
- rails7-mongoid9
include:
- ruby_version: '2.4'
gemfile: rails5-mongoid6
Expand Down
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ gem "mongoid_rails_migrations"
```

Create migration
```
```console
$ rails generate mongoid:migration <your_migration_name_here>
```

Run migrations:
```
```console
$ rails db:migrate
$ rails db:migrate:down VERSION=
$ rails db:migrate:up VERSION=
Expand All @@ -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']
```

Expand All @@ -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 <your_migration_name_here> --shards
```

Expand All @@ -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
```

Expand Down Expand Up @@ -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_
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid_rails_migrations/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MongoidRailsMigrations #:nodoc:
VERSION = '1.6.0'
VERSION = '1.6.1'
end
3 changes: 2 additions & 1 deletion mongoid_rails_migrations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3bb749d

Please sign in to comment.