116 lines
3.7 KiB
C#
116 lines
3.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BankYouBankruptDatabaseImplement.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class ChangeBD : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.RenameColumn(
|
|
name: "Date",
|
|
table: "Debitings",
|
|
newName: "DateOpen");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "DateClose",
|
|
table: "Debitings",
|
|
type: "datetime2",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "Status",
|
|
table: "Debitings",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "CashierId",
|
|
table: "CashWithdrawals",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "DebitingId",
|
|
table: "CashWithdrawals",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CashWithdrawals_CashierId",
|
|
table: "CashWithdrawals",
|
|
column: "CashierId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CashWithdrawals_DebitingId",
|
|
table: "CashWithdrawals",
|
|
column: "DebitingId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_CashWithdrawals_Cashiers_CashierId",
|
|
table: "CashWithdrawals",
|
|
column: "CashierId",
|
|
principalTable: "Cashiers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.NoAction);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_CashWithdrawals_Debitings_DebitingId",
|
|
table: "CashWithdrawals",
|
|
column: "DebitingId",
|
|
principalTable: "Debitings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.NoAction);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_CashWithdrawals_Cashiers_CashierId",
|
|
table: "CashWithdrawals");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_CashWithdrawals_Debitings_DebitingId",
|
|
table: "CashWithdrawals");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_CashWithdrawals_CashierId",
|
|
table: "CashWithdrawals");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_CashWithdrawals_DebitingId",
|
|
table: "CashWithdrawals");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DateClose",
|
|
table: "Debitings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Status",
|
|
table: "Debitings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CashierId",
|
|
table: "CashWithdrawals");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DebitingId",
|
|
table: "CashWithdrawals");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "DateOpen",
|
|
table: "Debitings",
|
|
newName: "Date");
|
|
}
|
|
}
|
|
}
|