| Bug #78257 | EntityFramework migrations sql reneration bug (alter table) | ||
|---|---|---|---|
| Submitted: | 28 Aug 2015 9:16 | Modified: | 31 Aug 2015 6:09 |
| Reporter: | Stef Rave | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 6.9.7 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[31 Aug 2015 6:09]
Chiranjeevi Battula
Hello Stef Rave, Thank you for the bug report. This is most likely duplicate of Bug #76292, please see Bug #76292 Thanks, Chiranjeevi.

Description: When creating a table with private key when doing automatic migrations from code. The following statement was generated: ALTER TABLE `Groups` ADD PRIMARY KEY (Key) This failes because "Key" is a reserved word The generated statement should have been: ALTER TABLE `Groups` ADD PRIMARY KEY (`Key`) When generating a script from the Visual Studio "Package Manager Console" using Update-Database with the "-Script" parameter, a correct statement is created. How to repeat: Do code first migration from: [Table("Hello")] public class Merchant { [Key] public int Key { get; set; } }