using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elements.Data.Migrations { /// public partial class Addcreationdates : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Recipes_Elements_FirstIngredientId", table: "Recipes"); migrationBuilder.DropForeignKey( name: "FK_Recipes_Elements_ResultId", table: "Recipes"); migrationBuilder.DropForeignKey( name: "FK_Recipes_Elements_SecondIngredientId", table: "Recipes"); migrationBuilder.RenameColumn( name: "SecondIngredientId", table: "Recipes", newName: "SecondElementId"); migrationBuilder.RenameColumn( name: "ResultId", table: "Recipes", newName: "ResultElementId"); migrationBuilder.RenameColumn( name: "FirstIngredientId", table: "Recipes", newName: "FirstElementId"); migrationBuilder.RenameIndex( name: "IX_Recipes_SecondIngredientId", table: "Recipes", newName: "IX_Recipes_SecondElementId"); migrationBuilder.RenameIndex( name: "IX_Recipes_ResultId", table: "Recipes", newName: "IX_Recipes_ResultElementId"); migrationBuilder.RenameIndex( name: "IX_Recipes_FirstIngredientId", table: "Recipes", newName: "IX_Recipes_FirstElementId"); migrationBuilder.AddColumn( name: "CreationDate", table: "Suggestions", type: "TEXT", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.AddColumn( name: "CreationDate", table: "Elements", type: "TEXT", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.UpdateData( table: "Elements", keyColumn: "Id", keyValue: 1, column: "CreationDate", value: new DateTime(2023, 10, 24, 19, 28, 3, 290, DateTimeKind.Utc).AddTicks(1750)); migrationBuilder.UpdateData( table: "Elements", keyColumn: "Id", keyValue: 2, column: "CreationDate", value: new DateTime(2023, 10, 24, 19, 28, 3, 290, DateTimeKind.Utc).AddTicks(2880)); migrationBuilder.UpdateData( table: "Elements", keyColumn: "Id", keyValue: 3, column: "CreationDate", value: new DateTime(2023, 10, 24, 19, 28, 3, 290, DateTimeKind.Utc).AddTicks(3350)); migrationBuilder.UpdateData( table: "Elements", keyColumn: "Id", keyValue: 4, column: "CreationDate", value: new DateTime(2023, 10, 24, 19, 28, 3, 290, DateTimeKind.Utc).AddTicks(3790)); migrationBuilder.AddForeignKey( name: "FK_Recipes_Elements_FirstElementId", table: "Recipes", column: "FirstElementId", principalTable: "Elements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Recipes_Elements_ResultElementId", table: "Recipes", column: "ResultElementId", principalTable: "Elements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Recipes_Elements_SecondElementId", table: "Recipes", column: "SecondElementId", principalTable: "Elements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Recipes_Elements_FirstElementId", table: "Recipes"); migrationBuilder.DropForeignKey( name: "FK_Recipes_Elements_ResultElementId", table: "Recipes"); migrationBuilder.DropForeignKey( name: "FK_Recipes_Elements_SecondElementId", table: "Recipes"); migrationBuilder.DropColumn( name: "CreationDate", table: "Suggestions"); migrationBuilder.DropColumn( name: "CreationDate", table: "Elements"); migrationBuilder.RenameColumn( name: "SecondElementId", table: "Recipes", newName: "SecondIngredientId"); migrationBuilder.RenameColumn( name: "ResultElementId", table: "Recipes", newName: "ResultId"); migrationBuilder.RenameColumn( name: "FirstElementId", table: "Recipes", newName: "FirstIngredientId"); migrationBuilder.RenameIndex( name: "IX_Recipes_SecondElementId", table: "Recipes", newName: "IX_Recipes_SecondIngredientId"); migrationBuilder.RenameIndex( name: "IX_Recipes_ResultElementId", table: "Recipes", newName: "IX_Recipes_ResultId"); migrationBuilder.RenameIndex( name: "IX_Recipes_FirstElementId", table: "Recipes", newName: "IX_Recipes_FirstIngredientId"); migrationBuilder.AddForeignKey( name: "FK_Recipes_Elements_FirstIngredientId", table: "Recipes", column: "FirstIngredientId", principalTable: "Elements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Recipes_Elements_ResultId", table: "Recipes", column: "ResultId", principalTable: "Elements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Recipes_Elements_SecondIngredientId", table: "Recipes", column: "SecondIngredientId", principalTable: "Elements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }