133 lines
5.7 KiB
C#
133 lines
5.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CompanyManagment.EFCore.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class addregisterininstitutioncontract : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "ContractingPartyId",
|
|
table: "Workshops",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "RegistrationStatus",
|
|
table: "Workshops",
|
|
type: "nvarchar(50)",
|
|
maxLength: 50,
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "LegalPosition",
|
|
table: "PersonalContractingParties",
|
|
type: "nvarchar(50)",
|
|
maxLength: 50,
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Status",
|
|
table: "InstitutionContracts",
|
|
type: "nvarchar(122)",
|
|
maxLength: 122,
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "InstitutionContractInstallments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
InstallmentDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
InstallmentDateFa = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
|
|
Amount = table.Column<double>(type: "float", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
|
|
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_InstitutionContractInstallments", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_InstitutionContractInstallments_InstitutionContracts_InstitutionContractId",
|
|
column: x => x.InstitutionContractId,
|
|
principalTable: "InstitutionContracts",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "InstitutionContractWorkshopDetail",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
WorkshopId = table.Column<long>(type: "bigint", nullable: true),
|
|
WorkshopName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
|
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: false),
|
|
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: false),
|
|
HasContractPlan = table.Column<bool>(type: "bit", nullable: false),
|
|
PersonnelCount = table.Column<int>(type: "int", nullable: false),
|
|
WorkshopCreated = table.Column<bool>(type: "bit", nullable: false),
|
|
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
|
|
Price = table.Column<double>(type: "float", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_InstitutionContractWorkshopDetail", x => x.id);
|
|
table.ForeignKey(
|
|
name: "FK_InstitutionContractWorkshopDetail_InstitutionContracts_InstitutionContractId",
|
|
column: x => x.InstitutionContractId,
|
|
principalTable: "InstitutionContracts",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_InstitutionContractInstallments_InstitutionContractId",
|
|
table: "InstitutionContractInstallments",
|
|
column: "InstitutionContractId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_InstitutionContractWorkshopDetail_InstitutionContractId",
|
|
table: "InstitutionContractWorkshopDetail",
|
|
column: "InstitutionContractId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "InstitutionContractInstallments");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "InstitutionContractWorkshopDetail");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ContractingPartyId",
|
|
table: "Workshops");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "RegistrationStatus",
|
|
table: "Workshops");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LegalPosition",
|
|
table: "PersonalContractingParties");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Status",
|
|
table: "InstitutionContracts");
|
|
}
|
|
}
|
|
}
|