using System;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
#nullable disable
|
|
namespace FlexJobApi.Database.Migrations.Migrations
|
{
|
/// <inheritdoc />
|
public partial class UpdateEnterprise0813 : Migration
|
{
|
/// <inheritdoc />
|
protected override void Up(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.DropTable(
|
name: "UserTaskCollect");
|
|
migrationBuilder.CreateTable(
|
name: "EnterpriseUserCollect",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
EnterpriseId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
IsCollected = table.Column<bool>(type: "bit", nullable: false),
|
CollectedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
IsContacted = table.Column<bool>(type: "bit", nullable: false),
|
ContactedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
CreatedEnterpriseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_EnterpriseUserCollect", x => x.Id);
|
table.ForeignKey(
|
name: "FK_EnterpriseUserCollect_Enterprise_EnterpriseId",
|
column: x => x.EnterpriseId,
|
principalTable: "Enterprise",
|
principalColumn: "Id",
|
onDelete: ReferentialAction.Cascade);
|
table.ForeignKey(
|
name: "FK_EnterpriseUserCollect_User_UserId",
|
column: x => x.UserId,
|
principalTable: "User",
|
principalColumn: "Id",
|
onDelete: ReferentialAction.Cascade);
|
});
|
|
migrationBuilder.CreateTable(
|
name: "TaskUserCollect",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
TaskInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
CreatedEnterpriseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_TaskUserCollect", x => x.Id);
|
table.ForeignKey(
|
name: "FK_TaskUserCollect_TaskInfo_TaskInfoId",
|
column: x => x.TaskInfoId,
|
principalTable: "TaskInfo",
|
principalColumn: "Id",
|
onDelete: ReferentialAction.Cascade);
|
table.ForeignKey(
|
name: "FK_TaskUserCollect_User_UserId",
|
column: x => x.UserId,
|
principalTable: "User",
|
principalColumn: "Id",
|
onDelete: ReferentialAction.Cascade);
|
});
|
|
migrationBuilder.CreateIndex(
|
name: "IX_EnterpriseUserCollect_EnterpriseId",
|
table: "EnterpriseUserCollect",
|
column: "EnterpriseId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_EnterpriseUserCollect_UserId",
|
table: "EnterpriseUserCollect",
|
column: "UserId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_TaskUserCollect_TaskInfoId",
|
table: "TaskUserCollect",
|
column: "TaskInfoId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_TaskUserCollect_UserId",
|
table: "TaskUserCollect",
|
column: "UserId");
|
}
|
|
/// <inheritdoc />
|
protected override void Down(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.DropTable(
|
name: "EnterpriseUserCollect");
|
|
migrationBuilder.DropTable(
|
name: "TaskUserCollect");
|
|
migrationBuilder.CreateTable(
|
name: "UserTaskCollect",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
TaskInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedEnterpriseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_UserTaskCollect", x => x.Id);
|
table.ForeignKey(
|
name: "FK_UserTaskCollect_TaskInfo_TaskInfoId",
|
column: x => x.TaskInfoId,
|
principalTable: "TaskInfo",
|
principalColumn: "Id",
|
onDelete: ReferentialAction.Cascade);
|
table.ForeignKey(
|
name: "FK_UserTaskCollect_User_UserId",
|
column: x => x.UserId,
|
principalTable: "User",
|
principalColumn: "Id",
|
onDelete: ReferentialAction.Cascade);
|
});
|
|
migrationBuilder.CreateIndex(
|
name: "IX_UserTaskCollect_TaskInfoId",
|
table: "UserTaskCollect",
|
column: "TaskInfoId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_UserTaskCollect_UserId",
|
table: "UserTaskCollect",
|
column: "UserId");
|
}
|
}
|
}
|