authz
authz copied to clipboard
Rails < 5.2 Unknown migration version "5.2"
Problem
The command rails g authz:install
copies the internal Authz migrations into the host application. The user is then prompted to run rails db:migrate
to 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.
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