IT:AD:EF/CodeFirst:HowTo:Migrations

You're truly FUBAR.

EDIT: The basis of the problem is that the Id is the Clustered Index – the order in which the rows are actually ordered in the table. And SQL Server doesn't allow you to change a tables clustered index, without dropping/recreating the table.

I never got the whole way through, but so far:

  • Drop the FK between the two.
  • Drop the index of the Primary table.
  • Drop the Default value (that generated the NEWSEQUENTIALID()) – that part i could not work out.
  • Change the Principal Id type.
  • Change the Dependent Id type.
  • Create the index to the primary table.
  • Create the relationship between the two.

The solution I did was: punch the screen.

  • Add mappings to Ignore the Entities
  • Dropped any FK properties on Dependents tables.
  • Generated the Migration.
  • Readded the table.
  • Grrr.
  • /home/skysigal/public_html/data/pages/it/ad/code_first/howto/migrations.txt
  • Last modified: 2023/11/04 03:39
  • by 127.0.0.1