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

Distinguish same foreign key constraint on multiple columns #278

Merged
merged 1 commit into from
Jul 13, 2019

Conversation

nagamoto
Copy link
Contributor

When there are multiple constraints that refer to the same data in one table,
Ridgepole cannot distinguish between the two constraints and considers them as duplicate operations, and an error occurs.

e.g.

ActiveRecord::Schema.define(version: 2019_07_11_071444) do

  create_table "direct_messages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "sender_id"
    t.bigint "reciever_id"
    t.text "body"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id"
    t.index ["sender_id"], name: "index_direct_messages_on_sender_id"
  end

  create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "email"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  add_foreign_key "direct_messages", "users", column: "reciever_id"
  add_foreign_key "direct_messages", "users", column: "sender_id"
end

Therefore, This PR makes Ridgepole distinguish from column name options as foreign key constraints.

Thanks for your great product.

Additional Information

*These link destinations are written in Japanese

@nagamoto nagamoto marked this pull request as ready for review July 11, 2019 11:18
@winebarrel
Copy link
Collaborator

Thank you!

@winebarrel winebarrel merged commit 99089f9 into ridgepole:0.7 Jul 13, 2019
@winebarrel winebarrel mentioned this pull request Jul 13, 2019
@winebarrel
Copy link
Collaborator

v0.7.8 has been released.

@nagamoto nagamoto deleted the 0.7_reflect-column-option branch July 18, 2019 08:02
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.

None yet

2 participants