Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Server Migrations: CreateIndex for Memory-Optimized Table ignores schema #10402

Closed
DenisKolpakov opened this issue Nov 26, 2017 · 1 comment
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@DenisKolpakov
Copy link

There is no chance to create index for memory-optimized table with schema different from [dbo] using migrations. Command does not use schema name to identify db object.

Exception message: Cannot find the object "UserInfo" because it does not exist or you do not have permissions

Stack trace:
      Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (88ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      ALTER TABLE [UserInfo] ADD INDEX [IX_NameIndex] NONCLUSTERED ([NameIndex]);
System.Data.SqlClient.SqlException (0x80131904): Cannot find the object "UserInfo" because it does not exist or you do not have permissions.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
...
            migrationBuilder.EnsureSchema(
                name: "Users");

            migrationBuilder.AlterDatabase()
                .Annotation("SqlServer:MemoryOptimized", true);

            migrationBuilder.CreateTable(
                name: "UserInfo",
                schema: "Users",
                columns: table => new
                {
                    ...
                })
                .Annotation("SqlServer:MemoryOptimized", true);

            ...

            migrationBuilder.CreateIndex(
                name: "IX_NameIndex",
                schema: "Users",
                table: "UserInfo",
                column: "NameIndex")
                .Annotation("SqlServer:Clustered", false);

Further technical details

EF Core version: 2.1.0-preview1-27654 and earlier
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: No matter (Rider 2017.2.1)

@ajcvickers ajcvickers added this to the 2.1.0 milestone Nov 27, 2017
@bricelam bricelam changed the title Error creating index for Memory-Optimized Table in schema different from [dbo] (or current) Migrations: CreateIndex for Memory-Optimized Table ignores schema Nov 27, 2017
@bricelam bricelam changed the title Migrations: CreateIndex for Memory-Optimized Table ignores schema SQL Server Migrations: CreateIndex for Memory-Optimized Table ignores schema Nov 27, 2017
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview1, 2.1.0 Jan 17, 2018
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 7, 2018
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview2, 2.1.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants