using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace EveryThing.Migrations { public partial class _17 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Invoices_Projects_ProjectIdProject", table: "Invoices"); migrationBuilder.DropIndex( name: "IX_Invoices_ProjectIdProject", table: "Invoices"); migrationBuilder.DropColumn( name: "ProjectIdProject", table: "Invoices"); migrationBuilder.AddColumn( name: "Note", table: "ProjectPartItems", type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "CodeTableOperations", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Title = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Default = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CodeTableOperations", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "ProjectPartItemOperations", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), IdProjectPartItemFk = table.Column(type: "int", nullable: false), IdCodeTableOperationFk = table.Column(type: "int", nullable: false), Finished = table.Column(type: "tinyint(1)", nullable: false), Order = table.Column(type: "smallint", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProjectPartItemOperations", x => x.Id); table.ForeignKey( name: "FK_ProjectPartItemOperations_CodeTableOperations_IdCodeTableOpe~", column: x => x.IdCodeTableOperationFk, principalTable: "CodeTableOperations", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_ProjectPartItemOperations_ProjectPartItems_IdProjectPartItem~", column: x => x.IdProjectPartItemFk, principalTable: "ProjectPartItems", principalColumn: "IdProjectPartItem", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_Invoices_IdProjectFk", table: "Invoices", column: "IdProjectFk"); migrationBuilder.CreateIndex( name: "IX_ProjectPartItemOperations_IdCodeTableOperationFk", table: "ProjectPartItemOperations", column: "IdCodeTableOperationFk"); migrationBuilder.CreateIndex( name: "IX_ProjectPartItemOperations_IdProjectPartItemFk", table: "ProjectPartItemOperations", column: "IdProjectPartItemFk"); migrationBuilder.AddForeignKey( name: "FK_Invoices_Projects_IdProjectFk", table: "Invoices", column: "IdProjectFk", principalTable: "Projects", principalColumn: "IdProject", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Invoices_Projects_IdProjectFk", table: "Invoices"); migrationBuilder.DropTable( name: "ProjectPartItemOperations"); migrationBuilder.DropTable( name: "CodeTableOperations"); migrationBuilder.DropIndex( name: "IX_Invoices_IdProjectFk", table: "Invoices"); migrationBuilder.DropColumn( name: "Note", table: "ProjectPartItems"); migrationBuilder.AddColumn( name: "ProjectIdProject", table: "Invoices", type: "int", nullable: true); migrationBuilder.CreateIndex( name: "IX_Invoices_ProjectIdProject", table: "Invoices", column: "ProjectIdProject"); migrationBuilder.AddForeignKey( name: "FK_Invoices_Projects_ProjectIdProject", table: "Invoices", column: "ProjectIdProject", principalTable: "Projects", principalColumn: "IdProject", onDelete: ReferentialAction.Restrict); } } }