views:

35

answers:

1

I am using subsonic simplerepo with migrations in dev and it makes things pretty easy but I keep running into issues with my nvarchar columns that have an index. My users table has an index defined on the username column for obvious reasons but each time I start the project subsonic is doing this:

ALTER TABLE [Users] ALTER COLUMN Username nvarchar(50);

which causes this:

The index 'IX_Username' is dependent on column 'Username'.ALTER TABLE ALTER COLUMN Username failed because one or more objects access this column

Is there any way around this issue?

A: 

Which DBMS are you using? Sql Server?

Never had a problem like this with MySQL, but it seems that your DBMS does not allow to alter a column with an index on it. This is not a SubSonic related issue.

Maybe you should do:

Execute("DROP index ...");
AlterColumn("...");
Execute("CREATE index ...");
SchlaWiener