dotnetcore / EntityFrameworkCore.KingbaseES

Entity Framework Core provider for KingbaseES Database
PostgreSQL License
47 stars 6 forks source link

Kdbndp.KingbaseException (0x80004005): 42601: syntax error at or near "max" #13

Closed hatzhang closed 6 months ago

hatzhang commented 6 months ago

以下Entity生成的迁移脚本时,会报如题的错。同样的迁移脚本不会报错,如果对着SqlServer跑的话。 可以支持这个nvarchar(max)的属性吗?

    public class ComplicatedDataEntity
    {
        public long ComplicatedDataEntityId { get; set; }
        public string Name { get; set; }
    }

Migration 类

 protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ComplicatedDataEntities",
                columns: table => new
                {
                    ComplicatedDataEntityId = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
...

例外:

Failed executing DbCommand (9ms) [Parameters=[], CommandType='Text', CommandTime CREATE TABLE "ComplicatedDataEntities" ( "ComplicatedDataEntityId" bigint NOT NULL, "Name" nvarchar(max) ); Kdbndp.KingbaseException (0x80004005): 42601: syntax error at or near "max"

hatzhang commented 6 months ago

我应该重新生成基于Kingbase的Migration,而非使用已经生成的SqlServer的Migrations.