You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
table define :
pc
{ id (auto increment) char_name (primary key ) user_id
}
when I db.Migrate() in empty database
app run throw a error
MySqlConnector.MySqlException:“Incorrect table definition; there can be only one auto column and it must be defined as a key”
I think this is related to the internal creation order of efcore, first creating tables (including primary keys and auto increment information), and then executing constraint statements
When MySQL creates a table, it does not include unique index information for self increasing columns
mysql sql scripts ,script is correct create table
CREATE TABLE `pc` (
`char_id` int(11) NOT NULL AUTO_INCREMENT,
`char_name` varchar(16) NOT NULL DEFAULT '',
`user_id` varchar(16) NOT NULL DEFAULT '',
PRIMARY KEY (`char_name`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
INDEX `char_id`(`char_id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 ROW_FORMAT = Dynamic;
model
public partial class PcEntity
{
public int char_id { get; set; }
public string char_name { get; set; } = null!;
public string user_id { get; set; } = null!;
}
in mysql 5.5.7 ,
table define :
pc
{
id (auto increment)
char_name (primary key )
user_id
}
when I db.Migrate() in empty database
app run throw a error
MySqlConnector.MySqlException:“Incorrect table definition; there can be only one auto column and it must be defined as a key”
I think this is related to the internal creation order of efcore, first creating tables (including primary keys and auto increment information), and then executing constraint statements
When MySQL creates a table, it does not include unique index information for self increasing columns
mysql sql scripts ,script is correct create table
model
configuration
Add-Migration Initial
The text was updated successfully, but these errors were encountered: