98 lines
4.3 KiB
C#
98 lines
4.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class u07 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Contracts",
|
|
schema: "CMS",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
HtmlContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Type = table.Column<int>(type: "int", nullable: false),
|
|
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Contracts", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserContracts",
|
|
schema: "CMS",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
UserId = table.Column<long>(type: "bigint", nullable: false),
|
|
ContractId = table.Column<long>(type: "bigint", nullable: false),
|
|
SignGuid = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
SignedPdfFile = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserContracts", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserContracts_Contracts_ContractId",
|
|
column: x => x.ContractId,
|
|
principalSchema: "CMS",
|
|
principalTable: "Contracts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_UserContracts_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalSchema: "CMS",
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserContracts_ContractId",
|
|
schema: "CMS",
|
|
table: "UserContracts",
|
|
column: "ContractId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserContracts_UserId",
|
|
schema: "CMS",
|
|
table: "UserContracts",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserContracts",
|
|
schema: "CMS");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Contracts",
|
|
schema: "CMS");
|
|
}
|
|
}
|
|
}
|