列を持つテーブルCustomizationSetがあります:
customization_set_guid (which is a non-nullable guid and also the primary key)
creator_account_guid
and a few others
そして、既存のデータを含むテーブル列への登録:
registration_id (an int and the primary key)
customization_set_guid (also a guid (so a char(36)) which is nullable, and all entries are currently null)
and a few other columns
実行してみると
ALTER TABLE Registration ADD FOREIGN KEY
(
customization_set_guid
) REFERENCES CustomizationSet (
customization_set_guid
);
MySQL Workbenchでは、エラー1050Table'。\dbname\registration'が既に存在します。
UIを使用して[テーブルの変更]ダイアログの[外部キー]タブで外部キーを追加しようとし、参照テーブルとしてCustomizationSetを選択すると、列のリストでcustomization_set_guidを選択できません。
この外部キーを追加できない理由がよくわかりません。追加したテーブル間に外部キーを正常に作成しました。登録テーブルはしばらくの間存在していました...