Murat
Murat

Reputation: 149

PostgreSql migration error

I have aspnet zero project and trying to use it with the Postgresql. I followed the instructions and when i tried to Update-Database it gaves me error:

Failed executing DbCommand (18ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE SEQUENCE "AppSubscriptionPayments_Id_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE; ALTER TABLE "AppSubscriptionPayments" ALTER COLUMN "Id" TYPE int8; ALTER TABLE "AppSubscriptionPayments" ALTER COLUMN "Id" SET NOT NULL; ALTER TABLE "AppSubscriptionPayments" ALTER COLUMN "Id" SET DEFAULT (nextval('"AppSubscriptionPayments_Id_seq"')); ALTER SEQUENCE "AppSubscriptionPayments_Id_seq" OWNED BY "AppSubscriptionPayments"."Id"

42P01: "AppSubscriptionPayments" object is not exists

I'm Using Postgresql 10, Visual Studio 2017 and ASPNET Zero.

Upvotes: 1

Views: 2499

Answers (1)

Alper Ebicoglu
Alper Ebicoglu

Reputation: 9624

  • Delete all existing migrations and Add-Migration from scratch.
  • Be sure there's not an existing database (that specified in the connection string) while you add-migrations. If you have an already created database before, migrations cannot be built correctly.

https://aspnetboilerplate.com/Pages/Documents/EF-Core-PostgreSql-Integration

Upvotes: 3

Related Questions