using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SchoolDatabaseImplements.Migrations { /// public partial class fix : Migration { /// 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( 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( 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); } /// 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( name: "DateOfPayment", table: "Payments", type: "datetime2", nullable: true, oldClrType: typeof(DateTime), oldType: "datetime2"); migrationBuilder.AddColumn( name: "CircleId", table: "Payments", type: "int", nullable: true); migrationBuilder.AddColumn( name: "CircleName", table: "Circles", type: "nvarchar(max)", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "LessonId", table: "Circles", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "Remains", table: "Circles", type: "float", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( 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"); } } }