@@ -16,5 +16,10 @@ namespace IRaCIS.Core.Test
|
||||
operation.ForeignKeys.Clear();
|
||||
base.Generate(operation, model, builder, terminate);
|
||||
}
|
||||
protected override void Generate(AddForeignKeyOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public partial class IRCContext : DbContext
|
||||
public virtual DbSet<ProjectUser> ProjectUser { get; set; }
|
||||
public virtual DbSet<ProjectUser2> ProjectUser2 { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<TestFieldName> TestFieldName { get; set; }
|
||||
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
||||
+78
-8
@@ -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")
|
||||
+22
-1
@@ -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");
|
||||
}
|
||||
+40
-7
@@ -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")
|
||||
+3
-15
@@ -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")
|
||||
|
||||
@@ -157,13 +157,13 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||
|
||||
public class ProjectUser : BaseFullAuditEntity
|
||||
{
|
||||
public string Name2 { get; set; }
|
||||
//public string Name2 { get; set; }
|
||||
|
||||
public string OtherName { get; set; }
|
||||
//public string OtherName { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
|
||||
public string Name2 { get; set; }
|
||||
|
||||
//外键
|
||||
public Guid ProjectId { get; set; }
|
||||
@@ -195,4 +195,16 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 测试命名不符合规则
|
||||
|
||||
public class TestFieldName : BaseFullAuditEntity
|
||||
{
|
||||
public string NAME1 { get; set; }
|
||||
|
||||
public string NAme2 { get; set; }
|
||||
|
||||
public string naMe3 { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user