164 lines
5.0 KiB
C#
164 lines
5.0 KiB
C#
|
using System;
|
|||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace SchoolDatabaseImplements.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class fix : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Payments_Circles_CircleId",
|
|||
|
table: "Payments");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_Payments_CircleId",
|
|||
|
table: "Payments");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "CircleId",
|
|||
|
table: "Payments");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "CircleName",
|
|||
|
table: "Circles");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "LessonId",
|
|||
|
table: "Circles");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "Remains",
|
|||
|
table: "Circles");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "LessonPrice",
|
|||
|
table: "CircleLessons");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "Name",
|
|||
|
table: "Expenses",
|
|||
|
newName: "ExpenseName");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "EmployeeId",
|
|||
|
table: "CircleLessons",
|
|||
|
newName: "Count");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<DateTime>(
|
|||
|
name: "DateOfPayment",
|
|||
|
table: "Payments",
|
|||
|
type: "datetime2",
|
|||
|
nullable: false,
|
|||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|||
|
oldClrType: typeof(DateTime),
|
|||
|
oldType: "datetime2",
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "EmployeeId",
|
|||
|
table: "Lessons",
|
|||
|
type: "int",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0);
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Lessons_EmployeeId",
|
|||
|
table: "Lessons",
|
|||
|
column: "EmployeeId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Lessons_Employees_EmployeeId",
|
|||
|
table: "Lessons",
|
|||
|
column: "EmployeeId",
|
|||
|
principalTable: "Employees",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Lessons_Employees_EmployeeId",
|
|||
|
table: "Lessons");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_Lessons_EmployeeId",
|
|||
|
table: "Lessons");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "EmployeeId",
|
|||
|
table: "Lessons");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "ExpenseName",
|
|||
|
table: "Expenses",
|
|||
|
newName: "Name");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "Count",
|
|||
|
table: "CircleLessons",
|
|||
|
newName: "EmployeeId");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<DateTime>(
|
|||
|
name: "DateOfPayment",
|
|||
|
table: "Payments",
|
|||
|
type: "datetime2",
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(DateTime),
|
|||
|
oldType: "datetime2");
|
|||
|
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "CircleId",
|
|||
|
table: "Payments",
|
|||
|
type: "int",
|
|||
|
nullable: true);
|
|||
|
|
|||
|
migrationBuilder.AddColumn<string>(
|
|||
|
name: "CircleName",
|
|||
|
table: "Circles",
|
|||
|
type: "nvarchar(max)",
|
|||
|
nullable: false,
|
|||
|
defaultValue: "");
|
|||
|
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "LessonId",
|
|||
|
table: "Circles",
|
|||
|
type: "int",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0);
|
|||
|
|
|||
|
migrationBuilder.AddColumn<double>(
|
|||
|
name: "Remains",
|
|||
|
table: "Circles",
|
|||
|
type: "float",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0.0);
|
|||
|
|
|||
|
migrationBuilder.AddColumn<double>(
|
|||
|
name: "LessonPrice",
|
|||
|
table: "CircleLessons",
|
|||
|
type: "float",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0.0);
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Payments_CircleId",
|
|||
|
table: "Payments",
|
|||
|
column: "CircleId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Payments_Circles_CircleId",
|
|||
|
table: "Payments",
|
|||
|
column: "CircleId",
|
|||
|
principalTable: "Circles",
|
|||
|
principalColumn: "Id");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|