小编Lyu*_*mir的帖子

关系“部门”不存在 EF Core 迁移错误

我正在学习learn.microsoft.com上的EF Core with MVC教程。

我有以下迁移:

using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace ContosoUniversity.Migrations
{
    public partial class ComplexDataModel : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<DateTime>(
                name: "EnrollmentDate",
                table: "Student",
                type: "timestamp with time zone",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone"
            );

            migrationBuilder.AlterColumn<string>(
                name: "Title",
                table: "Course",
                type: "character varying(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "text"
            );

            // migrationBuilder.AddColumn<int>(
            //     name: "DepartmentID",
            //     table: "Course",
            //     type: "integer",
            //     nullable: …
Run Code Online (Sandbox Code Playgroud)

postgresql quoted-identifier npgsql entity-framework-core

2
推荐指数
1
解决办法
4277
查看次数