Create fulltext index within Entity Framework Coded Migrations

后端 未结 1 1910
轮回少年
轮回少年 2021-01-04 07:37

TLDR; How do you add a full text index using Entity framework 5 coded migrations

I\'m having issues adding a full text index to a database using Ent

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 07:55

    I had a similar problem. My InitialCreate migration was creating a table and then attempting to add a full text index to that table, using the overloaded Sql() to indicate that it needs to execute outside the transaction. I was also getting a timeout error and I suspect it's due to a thread deadlock.

    I could get it to work in some scenarios by using Sql() calls instead of CreateTable() and by merging the CREATE FULL TEXT CATALOG and CREATE FULL TEXT INDEX statements into a single Sql() call. However, this wasn't very reliable. Sometimes it would work and sometimes it would fail with the same timeout error.

    The only reliable solution I found was to move the creation of the catalog and full text index into a separate migration.

    0 讨论(0)
提交回复
热议问题