EF creates a key on (MigrationId,ContextKey) which exceeds the hardcoded maximum key length constraint in some RDBMS (e.g. 767 bytes in mysql). MigrationId is 255 characters long, and ContextKey is 512 characters long, but each char can occupy more than 1 byte, so mysql is complaining.
VERBOSE: alter table __MigrationHistory add primary key `PK___MigrationHistory` ( `MigrationId`,`ContextKey`)
mysql Information: 3 : 2: Query Opened: alter table __MigrationHistory add primary key `PK___MigrationHistory` ( `MigrationId`,`ContextKey`)
mysql Information: 13 : 2: Error encountered attempting to open result: Number=1071, Message=Specified key was too long; max key length is 767 bytes
Comments: Discussed in the team room with the following conclusion. Given that the migrations history table is now configurable (see IHistoryContextFactory) and we plan to make it easier for providers to plug in their own history context factory (See http://entityframework.codeplex.com/workitem/562) we have decided that we will not make a change to the default key length. Changing the default key length for people who already have Migrations with a longer key is a breaking change, and even if we make it shorter it can't be guaranteed that it will work for all providers, so it seems that the extensibility and configurability changes are the better way to approach this.
VERBOSE: alter table __MigrationHistory add primary key `PK___MigrationHistory` ( `MigrationId`,`ContextKey`)
mysql Information: 3 : 2: Query Opened: alter table __MigrationHistory add primary key `PK___MigrationHistory` ( `MigrationId`,`ContextKey`)
mysql Information: 13 : 2: Error encountered attempting to open result: Number=1071, Message=Specified key was too long; max key length is 767 bytes
Comments: Discussed in the team room with the following conclusion. Given that the migrations history table is now configurable (see IHistoryContextFactory) and we plan to make it easier for providers to plug in their own history context factory (See http://entityframework.codeplex.com/workitem/562) we have decided that we will not make a change to the default key length. Changing the default key length for people who already have Migrations with a longer key is a breaking change, and even if we make it shorter it can't be guaranteed that it will work for all providers, so it seems that the extensibility and configurability changes are the better way to approach this.