修改迁移配置以及测试
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-09-17 23:16:11 +08:00
parent 65e47d9918
commit 19b647fb4a
15 changed files with 296 additions and 222 deletions
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
[DbContext(typeof(IRCContext))]
[Migration("20240912145208_test")]
partial class test
[Migration("20240917144649_TestName")]
partial class TestName
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -65,12 +65,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name2")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("OtherName")
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
@@ -119,6 +114,81 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
b.ToTable("ProjectUser2");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestFieldName", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("NAME1")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("NAme2")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("naMe3")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.ToTable("TestFieldName");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStr", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("DefineLength")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<string>("DefualtLength")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("MaxLength")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TestStr");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b =>
{
b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project")
@@ -6,11 +6,29 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class testSTR : Migration
public partial class TestName : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TestFieldName",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NAME1 = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
NAme2 = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
naMe3 = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TestFieldName", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TestStr",
columns: table => new
@@ -33,6 +51,9 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TestFieldName");
migrationBuilder.DropTable(
name: "TestStr");
}
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
[DbContext(typeof(IRCContext))]
[Migration("20240912152420_testSTR")]
partial class testSTR
[Migration("20240917145100_TestNameChange")]
partial class TestNameChange
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -70,11 +70,6 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("OtherName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<Guid>("ProjectId")
.HasColumnType("uniqueidentifier");
@@ -119,6 +114,44 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
b.ToTable("ProjectUser2");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestFieldName", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("NAME1")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("NAme2")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("naMe3")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.ToTable("TestFieldName");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStr", b =>
{
b.Property<Guid>("Id")
@@ -5,7 +5,7 @@
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class test : Migration
public partial class TestNameChange : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@@ -13,26 +13,14 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
migrationBuilder.RenameColumn(
name: "Name",
table: "ProjectUser",
newName: "OtherName");
migrationBuilder.AddColumn<string>(
name: "Name2",
table: "ProjectUser",
type: "nvarchar(200)",
maxLength: 200,
nullable: false,
defaultValue: "");
newName: "Name2");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Name2",
table: "ProjectUser");
migrationBuilder.RenameColumn(
name: "OtherName",
name: "Name2",
table: "ProjectUser",
newName: "Name");
}
@@ -67,11 +67,6 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("OtherName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<Guid>("ProjectId")
.HasColumnType("uniqueidentifier");
@@ -116,6 +111,44 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
b.ToTable("ProjectUser2");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestFieldName", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("NAME1")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("NAme2")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("naMe3")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.ToTable("TestFieldName");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStr", b =>
{
b.Property<Guid>("Id")