我有一个包含列的表 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 通过 Alter Table 对话框的 Foreign Keys 选项卡添加外键,并选择 CustomizationSet 作为引用表,它不会让我在列列表中选择 customization_set_guid。
我真的不知道为什么它不会让我添加这个外键。我刚刚在刚刚添加的表之间成功创建了外键。注册表已经存在了一段时间......