maglevhq / maglev-core

Ruby on Rails website builder
https://www.maglev.dev
MIT License
273 stars 47 forks source link

Migrations require Rails 6.1 #37

Closed brandondrew closed 1 year ago

brandondrew commented 1 year ago

I'm trying to add Maglev to a Rails 6.0 app, and expected it to work based on the README

Maglev is a page builder / CMS that you can plug in any Ruby on Rails 6+ application.

but most or all of the migrations specify 6.1. Is this necessary? Will I have problems if I change them to specify 6.0?

# This migration comes from maglev (originally 20210906102712)
class AddCanonicalToPages < ActiveRecord::Migration[6.0] # ⬅️ ⬅️ ⬅️ ⬅️ ⬅️ ⬅️  was 6.1
  def change
    add_column :maglev_page_paths, :canonical, :boolean, null: true, default: true
    add_index :maglev_page_paths, %i[canonical maglev_page_id locale], unique: true, name: 'canonical_uniqueness'
  end
end
did commented 1 year ago

Good question. It was generated from Rails 6.1 installation (the latest Rails version at the time I started the project). Based on this changelog, I don't see anything preventing you to replace ActiveRecord::Migration[6.0] by ActiveRecord::Migration[6.1]. If everything works on your side, I'll replace it in the repository as well. Thanks!

brandondrew commented 1 year ago

Thanks!

So far I haven't had any problem with changing 6.1 to 6.0, but I've only used Maglev in development. Another developer is updating our internal gem that conflicted with Rails 7, so I expect to be upgrading my app soon, and therefore I may not be able to say based on any production use that it's okay to make those changes to the migrations. But I'm 99% confident that they're safe to make.