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

foreign_key and references in migrations does not work #599

Open
jarl-dk opened this issue Jul 3, 2023 · 1 comment
Open

foreign_key and references in migrations does not work #599

jarl-dk opened this issue Jul 3, 2023 · 1 comment

Comments

@jarl-dk
Copy link

jarl-dk commented Jul 3, 2023

I would love to see support for foreign_key and references in migration to support composite keys.

such that the following will work:

def change
  create_table :tags do |t|
    t.string :user_first_name
    t.string :user_last_name

    t.foreign_key :user, column: [:first_name, :last_name], primary_key: [:user_first_name, :user_last_name]
  end
end

Similar for t.references

@cfis
Copy link
Contributor

cfis commented Jul 15, 2023

That would be a nice feature. Happy to take a patch if you would like to work on one.

Seems like work on composite primary keys is being done for ActiveRecord, hopefully that will include migration support.

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

2 participants