Generated Identifier Too Long For Constraint Name

You need to use shorter table name as there is no way to configure names of constraints. Note that you don't need to change class names to do that. You can either use Table attribute or use .ToTable() method in OnModelCreating.


To expand on my comment earlier on...

If you can just change the table name - then go with the mapping in the OnModelCreating - as @Pawel suggested, that's likely the easiest solution of all.

However, if you'd like to change just the name of the relation,

...by providing a custom SqlGenerator (i.e. the SqlServerMigrationSqlGenerator) in the Configuration() you can micro-manage the actual sql generated when needed (and that might be the generic, automated solution in some general case). e.g.

public class MySqlGenerator : SqlServerMigrationSqlGenerator
{
    protected override void Generate(AddForeignKeyOperation addForeignKeyOperation)
    {
        if (addForeignKeyOperation.Name == "LongClassNameOne_TypeConstraint_From_ClassName2s_To_LongClassNameOnes")
            addForeignKeyOperation.Name = "MyCustomFKName";
        // addForeignKeyOperation.Name = "Test" + addForeignKeyOperation.Name;
        base.Generate(addForeignKeyOperation);
    }
}

...or something along those lines (you need to match, find the right naming - or compare the Name Length and shorten it where needed. And in your Configuration (file generated by migrations)...

public Configuration()
{
    AutomaticMigrationsEnabled = false;
    SetSqlGenerator("MySqlMigrationSqlGenerator", new MySqlGenerator());
    // SetSqlGenerator("System.Data.SqlClient", new MySqlGenerator());
}

(note: I don't know for sure but it was suggested (by @Mariusz Jamro) that the MySQL provider's name is MySqlMigrationSqlGenerator, makes sense I guess)

...this should change the FK of the relation - and as far as could test this fast it works ok, as the relation name is not really used in the model from C# (just a db name normally).