One of the important things in my ORCID application was the database. I did not want migrate the database for the new Hanami version of my application to have access.
Turns out this is entirely possible. I copied over the migrations from my rails application and converted them into Hanami format so my test database could be created (and recreated). The conversion was relatively simple, although the documentation on indexes in Hanami was slim. I had to dig through the ROM documentation to find the correct syntax
Now the only issue was the schema table in development and all my other environments.
In Rails the schema table has a column named version
. In Hanami the schema table has a column named filname
.
It turns out if the table has both a filename
and a version
column both Rails and Hanami work file with it.
Iām sure I could have written some code, but I only had five migrations. So I created a SQL script by hand to add the filename column to the schema table and load the filenames.
After running the sql script, rspec could create/recreate the database and in development I could run hanami db migrate
without errors. I could also run rake db:migrate
over in my rails app without errors.
I have not deployed the new application to the servers, but I believe this strategy should translate to staging and production without issue.
Tiny side note here ROM Factory was a great replacement for FactoryBot. There are few syntactic changes, but it seems to be working well.