修改测试迁移
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-09-12 23:51:51 +08:00
parent c9b1e5f92a
commit 603f6e095c
15 changed files with 616 additions and 107 deletions
@@ -1,8 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Test.PGModelFolder;
namespace IRaCIS.Core.Test.CodeFirstTest.PGSQL.Migrations;
public abstract class BaseFullAuditEntity
{
[Key]
public Guid Id { get; set; }
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
}
public class TestStr : BaseFullAuditEntity
{
public string DefualtLength { get; set; }
[MaxLength]
public string MaxLength { get; set; }
[StringLength(400)]
public string DefineLength { get; set; }
}
public partial class PGContext : DbContext
{
@@ -15,7 +36,7 @@ public partial class PGContext : DbContext
{
}
public virtual DbSet<Subject> Subjects { get; set; }
public virtual DbSet<TestStr> TestStr { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseNpgsql("Host=106.14.89.110;Port=5432;Username=sa;Password=pgsql_pwd;Database=Test6_PG");
@@ -44,6 +65,13 @@ public partial class PGContext : DbContext
OnModelCreatingPartial(modelBuilder);
}
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
//configurationBuilder.Conventions.Add(_ => new NoForeignKeyConvention());
//针对字符串使用默认的长度配置
configurationBuilder.Conventions.Add(_ => new MaxStringLengthConvention());
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}