Skip to content

6.0 Upgrade Guide

Peter Solnica edited this page Apr 15, 2022 · 2 revisions

MRI >= 2.7 only

We've dropped support for MRI < 2.7, so please upgrade your Ruby first if needed.

Update Gemfile

  • ⚠️ REMOVE rom-core, rom-changeset and rom-repository from your Gemfile
  • Add rom, "6.0.0.alpha1 to your Gemfile

Backward compatibility mode

In this mode, old setup API should still work, to enable this mode:

  • Add require "rom/compat" to the place where rom is being configured

When enabled, you won't have to update your rom setup code.

The new setup API

⚠️ This section is a work in progress. It's recommended to stick to rom/compat until 6.0.0 beta.

If you decide to use the new setup API, there's no need to require rom/compat, but you will have to follow the following upgrade steps:

  1. Update usage of ROM::Configuration
# Before
setup = ROM::Configuration.new(:sql, "postgres://localhost/rom")

# After
setup = ROM::Setup.new(:sql, "postgres://localhost/rom")
  1. Update usage of auto_registration
# Before
setup.auto_registration(...)

# After
setup.auto_register(...)
  1. Update usage of ROM.container
# Before
rom = ROM.container(setup)

# After
rom = setup.finalize

rom-sql

⚠️ Full 6.0.0 support is still a work in progress, currently known limitations are:

  • In rom/compat mode, indexes schema DSL is not yet working
  • In rom/compat mode, aliased associations may not set correct dataset name

In order to upgrade:

  • Add gem "rom-sql", "6.0.0.alpha1" to you Gemfile