Skip to content
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

Fix rails migration templates for Rails 8 #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adamcarlile
Copy link

Having just tried to stand this project up in a new Rails 8 application the migration threw a couple of exceptions at me:

-- create_table(:oauth_saml_settings)
bin/rails aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

Unknown key: :unique. Valid keys are: :limit, :precision, :scale, :default, :null, :collation, :comment, :primary_key, :if_exists, :if_not_exists, :array, :using, :cast_as, :as, :type, :enum_type, :stored

Related to the missing index method, which then passes the unique constraint as a hash

ArgumentError: you can't redefine the primary key column 'jti' on 'oauth_dpop_proofs'. To define a custom primary key, pass { id: false } to create_table. (ArgumentError)

              raise ArgumentError, "you can't redefine the primary key column '#{name}' on '#{@name}'. To define a custom primary key, pass { id: false } to create_table."

I've changed this to specify id: false in order to allow the manual configuration of the PK

For issuer to have a unique constraint the method must have an `index` option, that has a hash, containing the `unique: true` constraint
Since the PK is already defined on the create_table declaration, we don't need to create the column again, as it will raise an exception when the migration is executed
Ensure that we don't accidentally create a unqiue constraint on this key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant