-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate from Rails to ROM Sequel migrations #485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
a923834 to
ac8f241
Compare
* Remove ActiveRecord::Migration.check_all_pending! Only verify DB connection * Create new dir for the rom migrations * Add new rake task for rom migrations: bundle exec rake rom:migrate * Add rake task to fix auto-increment sequences on existing tables * Convert Rails migrations to Sequel format migrations * Add rake task to mark migrations that have already applied ROM migration: * uses Sequel.migration do instead of class ..< ActiveRecord::Migration * we need to declare explicitly primary_key :id * String instead of string - DateTime, Date instead of datetime * Adds a new sequel_schema_migrations table related to [#403]
Update rom variable in specs related to [#403] Co-authored-by: Jane Sandberg <[email protected]>
ac8f241 to
299f49f
Compare
The issue here was that Rails tries to access rom in the config object but we run with :autoload instead of :environment so the ROM initializer does not run and rom is not defined with this fix we're checking first if it exists; If it doesn't we fall back to create a rom constainer using RomFactory.new.require_rom! related to [#403]
Co-authored-by: Jane Sandberg <[email protected]>
Co-authored-by: Christina Chortaria <[email protected]>
Co-authored-by: Jane Sandberg <[email protected]>
Co-authored-by: Jane Sandberg <[email protected]>
a656583 to
aa0a973
Compare
Co-authored-by: Christina Chortaria <[email protected]>
Co-authored-by: Christina Chortaria <[email protected]>
…e_searchable and tsvector :searchable Co-authored-by: Jane Sandberg <[email protected]>
Co-authored-by: Christina Chortaria <[email protected]>
to a new method to resolve reek warnings related to [#403]
|
In order to run the tests successfully please run: |
to test directly the db_connection Failure and Success related to [#403]
19d82f7 to
f2f2328
Compare
the fallback of the rails_rom_container in CSVLoadingService In cases where Rails.application is nil or Rails.application.config has not rom method it rescues the NoMethodError returns nil and falls back to RomFactory.new.require_rom! related to [#403]
table is missing or when sequel_schema_migration exists but one other table is missing related to [#403]
53c22bb to
c4f7bc1
Compare
that rom_if_available returns failure if database connection is not ready related to [#403]
27ccb11 to
b670ced
Compare
65c0007 to
4e0ec1a
Compare
| on roles(:db) do | ||
| within release_path do | ||
| with rails_env: fetch(:rails_env) do | ||
| execute :bundle, :exec, :rake, 'rom:migrations_applied' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to run this rake task for a 1st time setup. I ran it on staging when I deployed with capistrano this PR.
We should keep it for when we run it in production for the first time.
After that it is safe to remove it.
|
I renamed the migrate directory that has the Rails applications in case we need to compare something between the rails and rom migration files. |
ROM migration:
related to [#403]
when you checkout the branch:
lando destroybundle exec rake servers:startRAILS_ENV=test bundle exec rake rom:migratebundle exec rspecAlso load the application locally and run some queries to make sure everything is working locally.