I have a table called checklist in the PostgreSQL database of my .net-core 2.0 app, and have just added Identity Core following this doc. Afterwards, I ran:
dotnet ef migrations add identity
dotnet ef database update
The update resulted in this error:
Applying migration '20171018061542_InitialCreate'.
fail: Microsoft.EntityFrameworkCore.Database.Command[200102]
Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE SEQUENCE "checklist_id_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE;
Npgsql.PostgresException (0x80004005): 42P07: relation "checklist_id_seq" already exists
Would Identity Core also use a table called checklist, or am I making a mistake somewhere?
Edit: The checklist table and sequence checklist_id_seq were not added by Identity. They were there even before this was a .net-core project (it is EF database first).
I recently added migrations, and lines for checklist_id_seq exist in the initial migration.
All my tables exist in BOTH 20171018061542_InitialCreate.Designer.cs (the initial migration) and 20171019031817_identity.Designer.cs (the migration I did that I want to create the table(s) used by Identity)
So I guess the question is how to update the database with just the new tables from the "identity" migration?
Edit2: Seems like this is an issue with EF Core Migrations. See this SO question, and these issues: 4237 and 2167
Workaround:
Commented out everything in the Up(MigrationBuilder migrationBuilder) method of the initial migration.