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

docfix: name attribute for foreign key should be specified in index #1

Open
lowjoel opened this issue Jul 26, 2015 · 1 comment
Open

Comments

@lowjoel
Copy link
Member

lowjoel commented Jul 26, 2015

Specifying

    create_table :course_assessment_question_multiple_response_options do |t|
      t.references :question,
                   null: false,
                   foreign_key: {
                     name: :fk__course_assessment_multiple_response_option_question,
                     references: :course_assessment_question_multiple_responses
                   }
    end

errors with a name too long error. This works:

    create_table :course_assessment_question_multiple_response_options do |t|
      t.references :question,
                   null: false,
                   index: {
                     name: :fk__course_assessment_multiple_response_option_question,
                   },
                   foreign_key: {
                     references: :course_assessment_question_multiple_responses
                   }
    end
@lowjoel
Copy link
Member Author

lowjoel commented Jul 26, 2015

(don't ask why my schema names are so long, the app is crazy complex...)

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

No branches or pull requests

1 participant