PostgreSql 迁移错误

PostgreSql migration error

我有 aspnet 零项目并试图将它与 Postgresql 一起使用。我按照说明进行操作,当我尝试 Update-Database 时出现错误:

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

我正在使用 Postgresql 10、Visual Studio 2017 和 ASPNET 零。

  • 删除所有现有迁移并Add-Migration从头开始。
  • 请确保您 add-migrations 时没有现有数据库(在连接字符串中指定)。如果您之前已经创建了数据库,则无法正确构建迁移。

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