using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace WhiteLagoon.Infrastructure.Migrations { /// public partial class AddAmenityToDb : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Amenities", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: true), VillaId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Amenities", x => x.Id); table.ForeignKey( name: "FK_Amenities_Villas_VillaId", column: x => x.VillaId, principalTable: "Villas", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "Amenities", columns: new[] { "Id", "Description", "Name", "VillaId" }, values: new object[,] { { 1, null, "Private Pool", 1 }, { 2, null, "Microwave", 1 }, { 3, null, "Private Balcony", 1 }, { 4, null, "1 king bed and 1 sofa bed", 1 }, { 5, null, "Private Plunge Pool", 2 }, { 6, null, "Microwave and Mini Refrigerator", 2 }, { 7, null, "Private Balcony", 2 }, { 8, null, "king bed or 2 double beds", 2 }, { 9, null, "Private Pool", 3 }, { 10, null, "Jacuzzi", 3 }, { 11, null, "Private Balcony", 3 } }); migrationBuilder.CreateIndex( name: "IX_Amenities_VillaId", table: "Amenities", column: "VillaId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Amenities"); } } }