Coursach/Course/DatabaseImplement/Migrations/20240501121257_addtimeforguarantor.cs

72 lines
2.4 KiB
C#
Raw Normal View History

2024-05-01 16:14:12 +04:00
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DatabaseImplement.Migrations
{
public partial class addtimeforguarantor : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_WorkerMachines_Machines_WorkerId",
table: "WorkerMachines");
migrationBuilder.AddColumn<DateTime>(
name: "DateCreate",
table: "Workshops",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "DateCreate",
table: "Machines",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.CreateIndex(
name: "IX_WorkerMachines_MachineId",
table: "WorkerMachines",
column: "MachineId");
migrationBuilder.AddForeignKey(
name: "FK_WorkerMachines_Machines_MachineId",
table: "WorkerMachines",
column: "MachineId",
principalTable: "Machines",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_WorkerMachines_Machines_MachineId",
table: "WorkerMachines");
migrationBuilder.DropIndex(
name: "IX_WorkerMachines_MachineId",
table: "WorkerMachines");
migrationBuilder.DropColumn(
name: "DateCreate",
table: "Workshops");
migrationBuilder.DropColumn(
name: "DateCreate",
table: "Machines");
migrationBuilder.AddForeignKey(
name: "FK_WorkerMachines_Machines_WorkerId",
table: "WorkerMachines",
column: "WorkerId",
principalTable: "Machines",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}