using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VOL.Core.Migrations { public partial class _20250313v2 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "Modifier", table: "Y_Stadium", type: "int", nullable: true, comment: "修改人", oldClrType: typeof(int), oldType: "int", oldComment: "修改人"); migrationBuilder.AlterColumn( name: "Creator", table: "Y_Stadium", type: "int", nullable: true, comment: "创建人", oldClrType: typeof(int), oldType: "int", oldComment: "创建人"); migrationBuilder.AlterColumn( name: "CreateDate", table: "Y_Stadium", type: "datetime", nullable: true, comment: "创建时间", oldClrType: typeof(DateTime), oldType: "datetime", oldComment: "创建时间"); migrationBuilder.CreateTable( name: "Y_CurricularTaxonomy", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), TaxonomyName = table.Column(type: "nvarchar(100)", nullable: true, comment: "分类名称"), Remarks = table.Column(type: "text", nullable: true, comment: "备注"), Creator = table.Column(type: "int", nullable: true, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int", nullable: true, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间") }, constraints: table => { table.PrimaryKey("PK_Y_CurricularTaxonomy", x => x.Id); }); migrationBuilder.CreateTable( name: "Y_Curricular", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), TaxonomyId = table.Column(type: "int", nullable: false, comment: "分类Id"), CurricularName = table.Column(type: "nvarchar(100)", nullable: true, comment: "课程名称"), CoverImage = table.Column(type: "nvarchar(2000)", nullable: true, comment: "封面图"), Url = table.Column(type: "nvarchar(2000)", nullable: true, comment: "资源地址"), Hits = table.Column(type: "int", nullable: true, comment: "点击数"), Remarks = table.Column(type: "text", nullable: true, comment: "备注"), Creator = table.Column(type: "int", nullable: true, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int", nullable: true, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间") }, constraints: table => { table.PrimaryKey("PK_Y_Curricular", x => x.Id); table.ForeignKey( name: "FK_Y_Curricular_Y_CurricularTaxonomy_TaxonomyId", column: x => x.TaxonomyId, principalTable: "Y_CurricularTaxonomy", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Y_PopularCurricular", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), CurricularId = table.Column(type: "int", nullable: false, comment: "课程Id"), Remarks = table.Column(type: "text", nullable: true, comment: "备注"), Creator = table.Column(type: "int", nullable: true, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int", nullable: true, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间") }, constraints: table => { table.PrimaryKey("PK_Y_PopularCurricular", x => x.Id); table.ForeignKey( name: "FK_Y_PopularCurricular_Y_Curricular_CurricularId", column: x => x.CurricularId, principalTable: "Y_Curricular", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Y_Curricular"); migrationBuilder.DropTable( name: "Y_CurricularTaxonomy"); migrationBuilder.DropTable( name: "Y_PopularCurricular"); migrationBuilder.AlterColumn( name: "Modifier", table: "Y_Stadium", type: "int)", nullable: false, defaultValue: 0, comment: "修改人", oldClrType: typeof(int), oldType: "int)", oldNullable: true, oldComment: "修改人"); migrationBuilder.AlterColumn( name: "Creator", table: "Y_Stadium", type: "int)", nullable: false, defaultValue: 0, comment: "创建人", oldClrType: typeof(int), oldType: "int)", oldNullable: true, oldComment: "创建人"); migrationBuilder.AlterColumn( name: "CreateDate", table: "Y_Stadium", type: "datetime", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), comment: "创建时间", oldClrType: typeof(DateTime), oldType: "datetime", oldNullable: true, oldComment: "创建时间"); } } }