authz icon indicating copy to clipboard operation
authz copied to clipboard

Rails < 5.2 Unknown migration version "5.2"

Open serodriguez68 opened this issue 4 years ago • 1 comments

Problem

The command rails g authz:installcopies the internal Authz migrations into the host application. The user is then prompted to run rails db:migrateto setup all the tables that are required by Authz.

The problem is that all Authz migrations have a hardcoded < ActiveRecord::Migration[5.2] that does not adapt to the host's Rails version.

serodriguez68 avatar Jan 15 '20 10:01 serodriguez68

While we fix this, a possible workaround is to manually change the migration version from 5.2 to 5.1 and then running rails db:migrate again.

For example, for the CreateAuthzControllerActions migration:

class CreateAuthzControllerActions < ActiveRecord::Migration[5.1]
  def change
    create_table :authz_controller_actions do |t|
      t.string :controller
      t.string :action

      t.timestamps
    end
    add_index :authz_controller_actions, [:controller, :action], unique: true
  end
end

serodriguez68 avatar Jan 15 '20 10:01 serodriguez68