using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
///
public partial class addfile : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "CommonUploadRecordId",
table: "TrialSiteSurvey",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateTable(
name: "CommonUploadRecord",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
FileType = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件类型"),
FileName = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: false),
FileSize = table.Column(type: "bigint", nullable: false),
Path = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
CreateUserId = table.Column(type: "uniqueidentifier", nullable: false),
CreateTime = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CommonUploadRecord", x => x.Id)
.Annotation("SqlServer:Clustered", false);
table.ForeignKey(
name: "FK_CommonUploadRecord_User_CreateUserId",
column: x => x.CreateUserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
//migrationBuilder.CreateIndex(
// name: "IX_CommonUploadRecord_CreateTime",
// table: "CommonUploadRecord",
// column: "CreateTime")
// .Annotation("SqlServer:Clustered", true);
//migrationBuilder.AddForeignKey(
// name: "FK_TrialSiteSurvey_CommonUploadRecord_CommonUploadRecordId",
// table: "TrialSiteSurvey",
// column: "CommonUploadRecordId",
// principalTable: "CommonUploadRecord",
// principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TrialSiteSurvey_CommonUploadRecord_CommonUploadRecordId",
table: "TrialSiteSurvey");
migrationBuilder.DropTable(
name: "CommonUploadRecord");
migrationBuilder.DropColumn(
name: "CommonUploadRecordId",
table: "TrialSiteSurvey");
}
}
}