AlterColumn using WithLength problem

Topics: Writing modules
Feb 25, 2011 at 1:59 PM

I added a code below to add a column with specific length in migration.cs. And the code below runs ok without any error.

public int UpdateFrom1()
        {
            SchemaBuilder.AlterTable("ProductPartRecord", table => table
                    .AddColumn("Sku1",DbType.String, c => c.WithLength(180))
                );
           
            return 2;
        }

But when I tried to alter the table column with different length I get error. What am i doing wrong in the code below?

public int UpdateFrom2()
        {
            SchemaBuilder.AlterTable("ProductPartRecord", table => table
                    .AlterColumn("Sku1", c => c.WithLength(280))
                );

            return 3;
        }

Coordinator
Feb 28, 2011 at 11:53 PM

What error are you getting? What happens if you specify DbType.String?