repository migration

This commit is contained in:
2025-05-20 11:46:50 -04:00
commit bf536b8774
213 changed files with 117679 additions and 0 deletions
@@ -0,0 +1,68 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230804001201_AddVillaToDb")]
partial class AddVillaToDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("CreatedDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("UpdatedDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,42 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddVillaToDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Villas",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Price = table.Column<double>(type: "float", nullable: false),
Sqft = table.Column<int>(type: "int", nullable: false),
Occupancy = table.Column<int>(type: "int", nullable: false),
ImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdatedDate = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Villas", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Villas");
}
}
}
@@ -0,0 +1,68 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230804001243_ModfiyNamesInVillaTable")]
partial class ModfiyNamesInVillaTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class ModfiyNamesInVillaTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "UpdatedDate",
table: "Villas",
newName: "Updated_Date");
migrationBuilder.RenameColumn(
name: "CreatedDate",
table: "Villas",
newName: "Created_Date");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Updated_Date",
table: "Villas",
newName: "UpdatedDate");
migrationBuilder.RenameColumn(
name: "Created_Date",
table: "Villas",
newName: "CreatedDate");
}
}
}
@@ -0,0 +1,100 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230804001325_seedVillaToDb")]
partial class seedVillaToDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class seedVillaToDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Villas",
columns: new[] { "Id", "Created_Date", "Description", "ImageUrl", "Name", "Occupancy", "Price", "Sqft", "Updated_Date" },
values: new object[,]
{
{ 1, null, "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.", "https://placehold.co/600x400", "Royal Villa", 4, 200.0, 550, null },
{ 2, null, "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.", "https://placehold.co/600x401", "Premium Pool Villa", 4, 300.0, 550, null },
{ 3, null, "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.", "https://placehold.co/600x402", "Luxury Pool Villa", 4, 400.0, 750, null }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Villas",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Villas",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Villas",
keyColumn: "Id",
keyValue: 3);
}
}
}
@@ -0,0 +1,177 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230804004347_addVillaNumber")]
partial class addVillaNumber
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.Property<int>("Villa_Number")
.HasColumnType("int");
b.Property<string>("SpecialDetails")
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Villa_Number");
b.HasIndex("VillaId");
b.ToTable("VillaNumbers");
b.HasData(
new
{
Villa_Number = 101,
VillaId = 1
},
new
{
Villa_Number = 102,
VillaId = 1
},
new
{
Villa_Number = 103,
VillaId = 1
},
new
{
Villa_Number = 104,
VillaId = 1
},
new
{
Villa_Number = 201,
VillaId = 2
},
new
{
Villa_Number = 202,
VillaId = 2
},
new
{
Villa_Number = 203,
VillaId = 2
},
new
{
Villa_Number = 301,
VillaId = 3
},
new
{
Villa_Number = 302,
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class addVillaNumber : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Villas",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.CreateTable(
name: "VillaNumbers",
columns: table => new
{
Villa_Number = table.Column<int>(type: "int", nullable: false),
VillaId = table.Column<int>(type: "int", nullable: false),
SpecialDetails = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_VillaNumbers", x => x.Villa_Number);
table.ForeignKey(
name: "FK_VillaNumbers_Villas_VillaId",
column: x => x.VillaId,
principalTable: "Villas",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "VillaNumbers",
columns: new[] { "Villa_Number", "SpecialDetails", "VillaId" },
values: new object[,]
{
{ 101, null, 1 },
{ 102, null, 1 },
{ 103, null, 1 },
{ 104, null, 1 },
{ 201, null, 2 },
{ 202, null, 2 },
{ 203, null, 2 },
{ 301, null, 3 },
{ 302, null, 3 }
});
migrationBuilder.CreateIndex(
name: "IX_VillaNumbers_VillaId",
table: "VillaNumbers",
column: "VillaId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "VillaNumbers");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Villas",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50);
}
}
}
@@ -0,0 +1,281 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230804193317_AddAmenityToDb")]
partial class AddAmenityToDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VillaId");
b.ToTable("Amenities");
b.HasData(
new
{
Id = 1,
Name = "Private Pool",
VillaId = 1
},
new
{
Id = 2,
Name = "Microwave",
VillaId = 1
},
new
{
Id = 3,
Name = "Private Balcony",
VillaId = 1
},
new
{
Id = 4,
Name = "1 king bed and 1 sofa bed",
VillaId = 1
},
new
{
Id = 5,
Name = "Private Plunge Pool",
VillaId = 2
},
new
{
Id = 6,
Name = "Microwave and Mini Refrigerator",
VillaId = 2
},
new
{
Id = 7,
Name = "Private Balcony",
VillaId = 2
},
new
{
Id = 8,
Name = "king bed or 2 double beds",
VillaId = 2
},
new
{
Id = 9,
Name = "Private Pool",
VillaId = 3
},
new
{
Id = 10,
Name = "Jacuzzi",
VillaId = 3
},
new
{
Id = 11,
Name = "Private Balcony",
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.Property<int>("Villa_Number")
.HasColumnType("int");
b.Property<string>("SpecialDetails")
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Villa_Number");
b.HasIndex("VillaId");
b.ToTable("VillaNumbers");
b.HasData(
new
{
Villa_Number = 101,
VillaId = 1
},
new
{
Villa_Number = 102,
VillaId = 1
},
new
{
Villa_Number = 103,
VillaId = 1
},
new
{
Villa_Number = 104,
VillaId = 1
},
new
{
Villa_Number = 201,
VillaId = 2
},
new
{
Villa_Number = 202,
VillaId = 2
},
new
{
Villa_Number = 203,
VillaId = 2
},
new
{
Villa_Number = 301,
VillaId = 3
},
new
{
Villa_Number = 302,
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,67 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddAmenityToDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Amenities",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
VillaId = table.Column<int>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Amenities");
}
}
}
@@ -0,0 +1,535 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230806135013_AddIdentityToDb")]
partial class AddIdentityToDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VillaId");
b.ToTable("Amenities");
b.HasData(
new
{
Id = 1,
Name = "Private Pool",
VillaId = 1
},
new
{
Id = 2,
Name = "Microwave",
VillaId = 1
},
new
{
Id = 3,
Name = "Private Balcony",
VillaId = 1
},
new
{
Id = 4,
Name = "1 king bed and 1 sofa bed",
VillaId = 1
},
new
{
Id = 5,
Name = "Private Plunge Pool",
VillaId = 2
},
new
{
Id = 6,
Name = "Microwave and Mini Refrigerator",
VillaId = 2
},
new
{
Id = 7,
Name = "Private Balcony",
VillaId = 2
},
new
{
Id = 8,
Name = "king bed or 2 double beds",
VillaId = 2
},
new
{
Id = 9,
Name = "Private Pool",
VillaId = 3
},
new
{
Id = 10,
Name = "Jacuzzi",
VillaId = 3
},
new
{
Id = 11,
Name = "Private Balcony",
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.Property<int>("Villa_Number")
.HasColumnType("int");
b.Property<string>("SpecialDetails")
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Villa_Number");
b.HasIndex("VillaId");
b.ToTable("VillaNumbers");
b.HasData(
new
{
Villa_Number = 101,
VillaId = 1
},
new
{
Villa_Number = 102,
VillaId = 1
},
new
{
Villa_Number = 103,
VillaId = 1
},
new
{
Villa_Number = 104,
VillaId = 1
},
new
{
Villa_Number = 201,
VillaId = 2
},
new
{
Villa_Number = 202,
VillaId = 2
},
new
{
Villa_Number = 203,
VillaId = 2
},
new
{
Villa_Number = 301,
VillaId = 3
},
new
{
Villa_Number = 302,
VillaId = 3
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany("VillaAmenity")
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Navigation("VillaAmenity");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,224 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddIdentityToDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
}
}
}
@@ -0,0 +1,542 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230806135826_AddPropertiesToUsersTable")]
partial class AddPropertiesToUsersTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VillaId");
b.ToTable("Amenities");
b.HasData(
new
{
Id = 1,
Name = "Private Pool",
VillaId = 1
},
new
{
Id = 2,
Name = "Microwave",
VillaId = 1
},
new
{
Id = 3,
Name = "Private Balcony",
VillaId = 1
},
new
{
Id = 4,
Name = "1 king bed and 1 sofa bed",
VillaId = 1
},
new
{
Id = 5,
Name = "Private Plunge Pool",
VillaId = 2
},
new
{
Id = 6,
Name = "Microwave and Mini Refrigerator",
VillaId = 2
},
new
{
Id = 7,
Name = "Private Balcony",
VillaId = 2
},
new
{
Id = 8,
Name = "king bed or 2 double beds",
VillaId = 2
},
new
{
Id = 9,
Name = "Private Pool",
VillaId = 3
},
new
{
Id = 10,
Name = "Jacuzzi",
VillaId = 3
},
new
{
Id = 11,
Name = "Private Balcony",
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.Property<int>("Villa_Number")
.HasColumnType("int");
b.Property<string>("SpecialDetails")
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Villa_Number");
b.HasIndex("VillaId");
b.ToTable("VillaNumbers");
b.HasData(
new
{
Villa_Number = 101,
VillaId = 1
},
new
{
Villa_Number = 102,
VillaId = 1
},
new
{
Villa_Number = 103,
VillaId = 1
},
new
{
Villa_Number = 104,
VillaId = 1
},
new
{
Villa_Number = 201,
VillaId = 2
},
new
{
Villa_Number = 202,
VillaId = 2
},
new
{
Villa_Number = 203,
VillaId = 2
},
new
{
Villa_Number = 301,
VillaId = 3
},
new
{
Villa_Number = 302,
VillaId = 3
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany("VillaAmenity")
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Navigation("VillaAmenity");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddPropertiesToUsersTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "AspNetUsers",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "Name",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Name",
table: "AspNetUsers");
}
}
}
@@ -0,0 +1,635 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230807153245_addBookingToDb")]
partial class addBookingToDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VillaId");
b.ToTable("Amenities");
b.HasData(
new
{
Id = 1,
Name = "Private Pool",
VillaId = 1
},
new
{
Id = 2,
Name = "Microwave",
VillaId = 1
},
new
{
Id = 3,
Name = "Private Balcony",
VillaId = 1
},
new
{
Id = 4,
Name = "1 king bed and 1 sofa bed",
VillaId = 1
},
new
{
Id = 5,
Name = "Private Plunge Pool",
VillaId = 2
},
new
{
Id = 6,
Name = "Microwave and Mini Refrigerator",
VillaId = 2
},
new
{
Id = 7,
Name = "Private Balcony",
VillaId = 2
},
new
{
Id = 8,
Name = "king bed or 2 double beds",
VillaId = 2
},
new
{
Id = 9,
Name = "Private Pool",
VillaId = 3
},
new
{
Id = 10,
Name = "Jacuzzi",
VillaId = 3
},
new
{
Id = 11,
Name = "Private Balcony",
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Booking", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("ActualCheckInDate")
.HasColumnType("datetime2");
b.Property<DateTime>("ActualCheckOutDate")
.HasColumnType("datetime2");
b.Property<DateTime>("BookingDate")
.HasColumnType("datetime2");
b.Property<DateOnly>("CheckInDate")
.HasColumnType("date");
b.Property<DateOnly>("CheckOutDate")
.HasColumnType("date");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsPaymentSuccessful")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Nights")
.HasColumnType("int");
b.Property<DateTime>("PaymentDate")
.HasColumnType("datetime2");
b.Property<string>("Phone")
.HasColumnType("nvarchar(max)");
b.Property<string>("Status")
.HasColumnType("nvarchar(max)");
b.Property<string>("StripePaymentIntentId")
.HasColumnType("nvarchar(max)");
b.Property<string>("StripeSessionId")
.HasColumnType("nvarchar(max)");
b.Property<double>("TotalCost")
.HasColumnType("float");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.Property<int>("VillaNumber")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("VillaId");
b.ToTable("Bookings");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.Property<int>("Villa_Number")
.HasColumnType("int");
b.Property<string>("SpecialDetails")
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Villa_Number");
b.HasIndex("VillaId");
b.ToTable("VillaNumbers");
b.HasData(
new
{
Villa_Number = 101,
VillaId = 1
},
new
{
Villa_Number = 102,
VillaId = 1
},
new
{
Villa_Number = 103,
VillaId = 1
},
new
{
Villa_Number = 104,
VillaId = 1
},
new
{
Villa_Number = 201,
VillaId = 2
},
new
{
Villa_Number = 202,
VillaId = 2
},
new
{
Villa_Number = 203,
VillaId = 2
},
new
{
Villa_Number = 301,
VillaId = 3
},
new
{
Villa_Number = 302,
VillaId = 3
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany("VillaAmenity")
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Booking", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Navigation("VillaAmenity");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class addBookingToDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Bookings",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
VillaId = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
Phone = table.Column<string>(type: "nvarchar(max)", nullable: true),
TotalCost = table.Column<double>(type: "float", nullable: false),
Nights = table.Column<int>(type: "int", nullable: false),
Status = table.Column<string>(type: "nvarchar(max)", nullable: true),
BookingDate = table.Column<DateTime>(type: "datetime2", nullable: false),
CheckInDate = table.Column<DateOnly>(type: "date", nullable: false),
CheckOutDate = table.Column<DateOnly>(type: "date", nullable: false),
IsPaymentSuccessful = table.Column<bool>(type: "bit", nullable: false),
PaymentDate = table.Column<DateTime>(type: "datetime2", nullable: false),
StripeSessionId = table.Column<string>(type: "nvarchar(max)", nullable: true),
StripePaymentIntentId = table.Column<string>(type: "nvarchar(max)", nullable: true),
ActualCheckInDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ActualCheckOutDate = table.Column<DateTime>(type: "datetime2", nullable: false),
VillaNumber = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Bookings", x => x.Id);
table.ForeignKey(
name: "FK_Bookings_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Bookings_Villas_VillaId",
column: x => x.VillaId,
principalTable: "Villas",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Bookings_UserId",
table: "Bookings",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Bookings_VillaId",
table: "Bookings",
column: "VillaId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Bookings");
}
}
}
@@ -0,0 +1,632 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WhiteLagoon.Infrastructure.Data;
#nullable disable
namespace WhiteLagoon.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.6.23329.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VillaId");
b.ToTable("Amenities");
b.HasData(
new
{
Id = 1,
Name = "Private Pool",
VillaId = 1
},
new
{
Id = 2,
Name = "Microwave",
VillaId = 1
},
new
{
Id = 3,
Name = "Private Balcony",
VillaId = 1
},
new
{
Id = 4,
Name = "1 king bed and 1 sofa bed",
VillaId = 1
},
new
{
Id = 5,
Name = "Private Plunge Pool",
VillaId = 2
},
new
{
Id = 6,
Name = "Microwave and Mini Refrigerator",
VillaId = 2
},
new
{
Id = 7,
Name = "Private Balcony",
VillaId = 2
},
new
{
Id = 8,
Name = "king bed or 2 double beds",
VillaId = 2
},
new
{
Id = 9,
Name = "Private Pool",
VillaId = 3
},
new
{
Id = 10,
Name = "Jacuzzi",
VillaId = 3
},
new
{
Id = 11,
Name = "Private Balcony",
VillaId = 3
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Booking", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("ActualCheckInDate")
.HasColumnType("datetime2");
b.Property<DateTime>("ActualCheckOutDate")
.HasColumnType("datetime2");
b.Property<DateTime>("BookingDate")
.HasColumnType("datetime2");
b.Property<DateOnly>("CheckInDate")
.HasColumnType("date");
b.Property<DateOnly>("CheckOutDate")
.HasColumnType("date");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsPaymentSuccessful")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Nights")
.HasColumnType("int");
b.Property<DateTime>("PaymentDate")
.HasColumnType("datetime2");
b.Property<string>("Phone")
.HasColumnType("nvarchar(max)");
b.Property<string>("Status")
.HasColumnType("nvarchar(max)");
b.Property<string>("StripePaymentIntentId")
.HasColumnType("nvarchar(max)");
b.Property<string>("StripeSessionId")
.HasColumnType("nvarchar(max)");
b.Property<double>("TotalCost")
.HasColumnType("float");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.Property<int>("VillaNumber")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("VillaId");
b.ToTable("Bookings");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("Created_Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Occupancy")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<int>("Sqft")
.HasColumnType("int");
b.Property<DateTime?>("Updated_Date")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Villas");
b.HasData(
new
{
Id = 1,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x400",
Name = "Royal Villa",
Occupancy = 4,
Price = 200.0,
Sqft = 550
},
new
{
Id = 2,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x401",
Name = "Premium Pool Villa",
Occupancy = 4,
Price = 300.0,
Sqft = 550
},
new
{
Id = 3,
Description = "Fusce 11 tincidunt maximus leo, sed scelerisque massa auctor sit amet. Donec ex mauris, hendrerit quis nibh ac, efficitur fringilla enim.",
ImageUrl = "https://placehold.co/600x402",
Name = "Luxury Pool Villa",
Occupancy = 4,
Price = 400.0,
Sqft = 750
});
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.Property<int>("Villa_Number")
.HasColumnType("int");
b.Property<string>("SpecialDetails")
.HasColumnType("nvarchar(max)");
b.Property<int>("VillaId")
.HasColumnType("int");
b.HasKey("Villa_Number");
b.HasIndex("VillaId");
b.ToTable("VillaNumbers");
b.HasData(
new
{
Villa_Number = 101,
VillaId = 1
},
new
{
Villa_Number = 102,
VillaId = 1
},
new
{
Villa_Number = 103,
VillaId = 1
},
new
{
Villa_Number = 104,
VillaId = 1
},
new
{
Villa_Number = 201,
VillaId = 2
},
new
{
Villa_Number = 202,
VillaId = 2
},
new
{
Villa_Number = 203,
VillaId = 2
},
new
{
Villa_Number = 301,
VillaId = 3
},
new
{
Villa_Number = 302,
VillaId = 3
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Amenity", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany("VillaAmenity")
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Booking", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.VillaNumber", b =>
{
b.HasOne("WhiteLagoon.Domain.Entities.Villa", "Villa")
.WithMany()
.HasForeignKey("VillaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Villa");
});
modelBuilder.Entity("WhiteLagoon.Domain.Entities.Villa", b =>
{
b.Navigation("VillaAmenity");
});
#pragma warning restore 612, 618
}
}
}