209 lines
7.2 KiB
C#
209 lines
7.2 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace VOL.Core.Migrations
|
|
{
|
|
public partial class _20260109v4 : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "SchoolCode",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)",
|
|
oldNullable: true,
|
|
oldComment: "学校编号");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "GradeNo",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)",
|
|
oldNullable: true,
|
|
oldComment: "年级编号");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "GradeName",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)",
|
|
oldNullable: true,
|
|
oldComment: "年级名称");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Code",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)",
|
|
oldNullable: true,
|
|
oldComment: "AI设备的唯一编码");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ClassNo",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)",
|
|
oldNullable: true,
|
|
oldComment: "班级编号");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ClassName",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)",
|
|
oldNullable: true,
|
|
oldComment: "班级名称");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "Id",
|
|
table: "JS_Class",
|
|
type: "bigint",
|
|
nullable: false,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint",
|
|
oldComment: "Id")
|
|
.Annotation("SqlServer:Identity", "1, 1")
|
|
.OldAnnotation("SqlServer:Identity", "1, 1");
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "GradeId",
|
|
table: "JS_Class",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JS_Grade",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false),
|
|
Code = table.Column<string>(type: "nvarchar(100)", nullable: false),
|
|
GradeNo = table.Column<string>(type: "nvarchar(100)", nullable: false),
|
|
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JS_Grade", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JS_Class_GradeId",
|
|
table: "JS_Class",
|
|
column: "GradeId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_JS_Class_JS_Grade_GradeId",
|
|
table: "JS_Class",
|
|
column: "GradeId",
|
|
principalTable: "JS_Grade",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_JS_Class_JS_Grade_GradeId",
|
|
table: "JS_Class");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JS_Grade");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_JS_Class_GradeId",
|
|
table: "JS_Class");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "GradeId",
|
|
table: "JS_Class");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "SchoolCode",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: true,
|
|
comment: "学校编号",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "GradeNo",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: true,
|
|
comment: "年级编号",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "GradeName",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: true,
|
|
comment: "年级名称",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Code",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: true,
|
|
comment: "AI设备的唯一编码",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ClassNo",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: true,
|
|
comment: "班级编号",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ClassName",
|
|
table: "JS_Class",
|
|
type: "nvarchar(100)",
|
|
nullable: true,
|
|
comment: "班级名称",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(100)");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "Id",
|
|
table: "JS_Class",
|
|
type: "bigint",
|
|
nullable: false,
|
|
comment: "Id",
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint")
|
|
.Annotation("SqlServer:Identity", "1, 1")
|
|
.OldAnnotation("SqlServer:Identity", "1, 1");
|
|
}
|
|
}
|
|
}
|