EntityFramework6.Npgsql
EntityFramework6.Npgsql copied to clipboard
Code first migrations fail to create multi column indexes
According to MSDN it is possible to specify multi column (unique) indexes using attributes. Hence I would expect them to be created accordingly during a migration. Unfortunately only the first column is added to the index :/
https://msdn.microsoft.com/en-us/data/jj591583.aspx#IndexMulti
I checked the Migration SQL generator implementation of Npgsql and it looks fine. For some reason it seems like the entity framework is not passing on the complete set of columns, resulting in Npgsql also simple not adding them all to the index to be created. The result is an index being created only on the first column.
Am I missing something?
I created a pull request which expands on the migration unit tests to demonstrate the problem: npgsql/EntityFramework6.Npgsql#46
@rwasef1830 you may want to take a look at this
When will this bug fixed? This bug is annoying...
I'm using EF 6.1 and CodeFirst. I like to create a multi column unique index!
Unless I'm mistaken you should be able to work around this issue by specifying raw SQL in your migrations.
Do I understand correctly that this issue is not resolved quickly?
@Int32Overflow I personally will not have time to look into this anytime soon - maybe @rwasef1830 will be able to. Again, this should be considered non-critical as IIRC it should be possible to work around this by creating your indices in your migrations with raw SQL.