insert datas

This commit is contained in:
2026-03-10 08:35:40 +01:00
parent ecdabab5a1
commit 2e7b9e5154
185 changed files with 2361 additions and 1355 deletions

View File

@@ -0,0 +1,492 @@
// <auto-generated />
using System;
using BookHive;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BookHive.Migrations
{
[DbContext(typeof(BookHiveDbContext))]
[Migration("20260310073123_AddedData")]
partial class AddedData
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Biography")
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<DateOnly>("BirthDate")
.HasColumnType("date");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Nationality")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Id");
b.ToTable("Authors");
b.HasData(
new
{
Id = 1,
Biography = "Auteur britannique connu pour ses romans dystopiques.",
BirthDate = new DateOnly(1903, 6, 25),
FirstName = "George",
LastName = "Orwell",
Nationality = "Britannique"
},
new
{
Id = 2,
Biography = "Romancière anglaise célèbre pour ses romans sur la société.",
BirthDate = new DateOnly(1775, 12, 16),
FirstName = "Jane",
LastName = "Austen",
Nationality = "Britannique"
},
new
{
Id = 3,
Biography = "Poète et écrivain français du XIXe siècle.",
BirthDate = new DateOnly(1802, 2, 26),
FirstName = "Victor",
LastName = "Hugo",
Nationality = "Française"
});
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AuthorId")
.HasColumnType("int");
b.Property<string>("Genre")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Isbn")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("PageCount")
.HasColumnType("int");
b.Property<DateOnly>("PublishedDate")
.HasColumnType("date");
b.Property<string>("Summary")
.HasMaxLength(3000)
.HasColumnType("nvarchar(3000)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("Books");
b.HasData(
new
{
Id = 1,
AuthorId = 1,
Genre = "Dystopie",
Isbn = "9780451524935",
PageCount = 328,
PublishedDate = new DateOnly(1949, 6, 8),
Summary = "Roman dystopique sur un régime totalitaire.",
Title = "1984"
},
new
{
Id = 2,
AuthorId = 1,
Genre = "Satire",
Isbn = "9780451526342",
PageCount = 112,
PublishedDate = new DateOnly(1945, 8, 17),
Summary = "Satire politique sous forme de fable animale.",
Title = "Animal Farm"
},
new
{
Id = 3,
AuthorId = 2,
Genre = "Roman",
Isbn = "9780141439518",
PageCount = 279,
PublishedDate = new DateOnly(1813, 1, 28),
Summary = "Histoire romantique dans l'Angleterre du XIXe siècle.",
Title = "Pride and Prejudice"
},
new
{
Id = 4,
AuthorId = 2,
Genre = "Roman",
Isbn = "9780141439662",
PageCount = 226,
PublishedDate = new DateOnly(1811, 10, 30),
Summary = "Roman sur les sœurs Dashwood.",
Title = "Sense and Sensibility"
},
new
{
Id = 5,
AuthorId = 3,
Genre = "Roman historique",
Isbn = "9782070409189",
PageCount = 1463,
PublishedDate = new DateOnly(1862, 4, 3),
Summary = "Grande fresque sociale sur la misère et la justice.",
Title = "Les Misérables"
},
new
{
Id = 6,
AuthorId = 3,
Genre = "Roman historique",
Isbn = "9782253004226",
PageCount = 940,
PublishedDate = new DateOnly(1831, 1, 14),
Summary = "Roman historique se déroulant à Paris.",
Title = "Notre-Dame de Paris"
});
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<DateOnly>("DueDate")
.HasColumnType("date");
b.Property<DateOnly>("LoanDate")
.HasColumnType("date");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<DateOnly?>("ReturnDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("MemberId");
b.ToTable("Loans");
b.HasData(
new
{
Id = 1,
BookId = 1,
DueDate = new DateOnly(2025, 12, 15),
LoanDate = new DateOnly(2025, 12, 1),
MemberId = 1,
ReturnDate = new DateOnly(2025, 12, 10)
},
new
{
Id = 2,
BookId = 2,
DueDate = new DateOnly(2025, 12, 20),
LoanDate = new DateOnly(2025, 12, 5),
MemberId = 2,
ReturnDate = new DateOnly(2025, 12, 18)
},
new
{
Id = 3,
BookId = 3,
DueDate = new DateOnly(2025, 12, 25),
LoanDate = new DateOnly(2025, 12, 10),
MemberId = 3
},
new
{
Id = 4,
BookId = 4,
DueDate = new DateOnly(2025, 12, 27),
LoanDate = new DateOnly(2025, 12, 12),
MemberId = 1
},
new
{
Id = 5,
BookId = 5,
DueDate = new DateOnly(2025, 11, 15),
LoanDate = new DateOnly(2025, 11, 1),
MemberId = 2,
ReturnDate = new DateOnly(2025, 11, 14)
});
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateOnly>("MembershipDate")
.HasColumnType("date");
b.HasKey("Id");
b.ToTable("Members");
b.HasData(
new
{
Id = 1,
Email = "alice@example.com",
FirstName = "Alice",
IsActive = true,
LastName = "Martin",
MembershipDate = new DateOnly(2023, 1, 10)
},
new
{
Id = 2,
Email = "bob@example.com",
FirstName = "Bob",
IsActive = true,
LastName = "Durand",
MembershipDate = new DateOnly(2023, 5, 12)
},
new
{
Id = 3,
Email = "claire@example.com",
FirstName = "Claire",
IsActive = true,
LastName = "Petit",
MembershipDate = new DateOnly(2024, 2, 2)
},
new
{
Id = 4,
Email = "david@example.com",
FirstName = "David",
IsActive = true,
LastName = "Bernard",
MembershipDate = new DateOnly(2024, 6, 15)
});
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<string>("Comment")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<int>("Rating")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("MemberId");
b.HasIndex("BookId", "MemberId")
.IsUnique();
b.ToTable("Reviews");
b.HasData(
new
{
Id = 1,
BookId = 1,
Comment = "Un chef-d'œuvre dystopique.",
CreatedAt = new DateTime(2025, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 1,
Rating = 5
},
new
{
Id = 2,
BookId = 3,
Comment = "Très bon roman classique.",
CreatedAt = new DateTime(2025, 12, 2, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 2,
Rating = 4
},
new
{
Id = 3,
BookId = 5,
Comment = "Incroyable roman historique.",
CreatedAt = new DateTime(2025, 12, 3, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 3,
Rating = 5
},
new
{
Id = 4,
BookId = 2,
Comment = "Drôle et intelligent.",
CreatedAt = new DateTime(2025, 12, 4, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 4,
Rating = 4
});
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.HasOne("BookHive.Models.Author", "Author")
.WithMany("Books")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Loans")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Loans")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Reviews")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Reviews")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Navigation("Books");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,188 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace BookHive.Migrations
{
/// <inheritdoc />
public partial class AddedData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Authors",
columns: new[] { "Id", "Biography", "BirthDate", "FirstName", "LastName", "Nationality" },
values: new object[,]
{
{ 1, "Auteur britannique connu pour ses romans dystopiques.", new DateOnly(1903, 6, 25), "George", "Orwell", "Britannique" },
{ 2, "Romancière anglaise célèbre pour ses romans sur la société.", new DateOnly(1775, 12, 16), "Jane", "Austen", "Britannique" },
{ 3, "Poète et écrivain français du XIXe siècle.", new DateOnly(1802, 2, 26), "Victor", "Hugo", "Française" }
});
migrationBuilder.InsertData(
table: "Members",
columns: new[] { "Id", "Email", "FirstName", "IsActive", "LastName", "MembershipDate" },
values: new object[,]
{
{ 1, "alice@example.com", "Alice", true, "Martin", new DateOnly(2023, 1, 10) },
{ 2, "bob@example.com", "Bob", true, "Durand", new DateOnly(2023, 5, 12) },
{ 3, "claire@example.com", "Claire", true, "Petit", new DateOnly(2024, 2, 2) },
{ 4, "david@example.com", "David", true, "Bernard", new DateOnly(2024, 6, 15) }
});
migrationBuilder.InsertData(
table: "Books",
columns: new[] { "Id", "AuthorId", "Genre", "Isbn", "PageCount", "PublishedDate", "Summary", "Title" },
values: new object[,]
{
{ 1, 1, "Dystopie", "9780451524935", 328, new DateOnly(1949, 6, 8), "Roman dystopique sur un régime totalitaire.", "1984" },
{ 2, 1, "Satire", "9780451526342", 112, new DateOnly(1945, 8, 17), "Satire politique sous forme de fable animale.", "Animal Farm" },
{ 3, 2, "Roman", "9780141439518", 279, new DateOnly(1813, 1, 28), "Histoire romantique dans l'Angleterre du XIXe siècle.", "Pride and Prejudice" },
{ 4, 2, "Roman", "9780141439662", 226, new DateOnly(1811, 10, 30), "Roman sur les sœurs Dashwood.", "Sense and Sensibility" },
{ 5, 3, "Roman historique", "9782070409189", 1463, new DateOnly(1862, 4, 3), "Grande fresque sociale sur la misère et la justice.", "Les Misérables" },
{ 6, 3, "Roman historique", "9782253004226", 940, new DateOnly(1831, 1, 14), "Roman historique se déroulant à Paris.", "Notre-Dame de Paris" }
});
migrationBuilder.InsertData(
table: "Loans",
columns: new[] { "Id", "BookId", "DueDate", "LoanDate", "MemberId", "ReturnDate" },
values: new object[,]
{
{ 1, 1, new DateOnly(2025, 12, 15), new DateOnly(2025, 12, 1), 1, new DateOnly(2025, 12, 10) },
{ 2, 2, new DateOnly(2025, 12, 20), new DateOnly(2025, 12, 5), 2, new DateOnly(2025, 12, 18) },
{ 3, 3, new DateOnly(2025, 12, 25), new DateOnly(2025, 12, 10), 3, null },
{ 4, 4, new DateOnly(2025, 12, 27), new DateOnly(2025, 12, 12), 1, null },
{ 5, 5, new DateOnly(2025, 11, 15), new DateOnly(2025, 11, 1), 2, new DateOnly(2025, 11, 14) }
});
migrationBuilder.InsertData(
table: "Reviews",
columns: new[] { "Id", "BookId", "Comment", "CreatedAt", "MemberId", "Rating" },
values: new object[,]
{
{ 1, 1, "Un chef-d'œuvre dystopique.", new DateTime(2025, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 5 },
{ 2, 3, "Très bon roman classique.", new DateTime(2025, 12, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), 2, 4 },
{ 3, 5, "Incroyable roman historique.", new DateTime(2025, 12, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 3, 5 },
{ 4, 2, "Drôle et intelligent.", new DateTime(2025, 12, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), 4, 4 }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Books",
keyColumn: "Id",
keyValue: 6);
migrationBuilder.DeleteData(
table: "Loans",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Loans",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Loans",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Loans",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "Loans",
keyColumn: "Id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "Reviews",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Reviews",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Reviews",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Reviews",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "Books",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Books",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Books",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Books",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "Books",
keyColumn: "Id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "Members",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Members",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Members",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Members",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "Authors",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Authors",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Authors",
keyColumn: "Id",
keyValue: 3);
}
}
}

View File

@@ -17,7 +17,7 @@ namespace BookHive.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.20")
.HasAnnotation("ProductVersion", "10.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -55,6 +55,35 @@ namespace BookHive.Migrations
b.HasKey("Id");
b.ToTable("Authors");
b.HasData(
new
{
Id = 1,
Biography = "Auteur britannique connu pour ses romans dystopiques.",
BirthDate = new DateOnly(1903, 6, 25),
FirstName = "George",
LastName = "Orwell",
Nationality = "Britannique"
},
new
{
Id = 2,
Biography = "Romancière anglaise célèbre pour ses romans sur la société.",
BirthDate = new DateOnly(1775, 12, 16),
FirstName = "Jane",
LastName = "Austen",
Nationality = "Britannique"
},
new
{
Id = 3,
Biography = "Poète et écrivain français du XIXe siècle.",
BirthDate = new DateOnly(1802, 2, 26),
FirstName = "Victor",
LastName = "Hugo",
Nationality = "Française"
});
});
modelBuilder.Entity("BookHive.Models.Book", b =>
@@ -97,6 +126,74 @@ namespace BookHive.Migrations
b.HasIndex("AuthorId");
b.ToTable("Books");
b.HasData(
new
{
Id = 1,
AuthorId = 1,
Genre = "Dystopie",
Isbn = "9780451524935",
PageCount = 328,
PublishedDate = new DateOnly(1949, 6, 8),
Summary = "Roman dystopique sur un régime totalitaire.",
Title = "1984"
},
new
{
Id = 2,
AuthorId = 1,
Genre = "Satire",
Isbn = "9780451526342",
PageCount = 112,
PublishedDate = new DateOnly(1945, 8, 17),
Summary = "Satire politique sous forme de fable animale.",
Title = "Animal Farm"
},
new
{
Id = 3,
AuthorId = 2,
Genre = "Roman",
Isbn = "9780141439518",
PageCount = 279,
PublishedDate = new DateOnly(1813, 1, 28),
Summary = "Histoire romantique dans l'Angleterre du XIXe siècle.",
Title = "Pride and Prejudice"
},
new
{
Id = 4,
AuthorId = 2,
Genre = "Roman",
Isbn = "9780141439662",
PageCount = 226,
PublishedDate = new DateOnly(1811, 10, 30),
Summary = "Roman sur les sœurs Dashwood.",
Title = "Sense and Sensibility"
},
new
{
Id = 5,
AuthorId = 3,
Genre = "Roman historique",
Isbn = "9782070409189",
PageCount = 1463,
PublishedDate = new DateOnly(1862, 4, 3),
Summary = "Grande fresque sociale sur la misère et la justice.",
Title = "Les Misérables"
},
new
{
Id = 6,
AuthorId = 3,
Genre = "Roman historique",
Isbn = "9782253004226",
PageCount = 940,
PublishedDate = new DateOnly(1831, 1, 14),
Summary = "Roman historique se déroulant à Paris.",
Title = "Notre-Dame de Paris"
});
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
@@ -129,6 +226,51 @@ namespace BookHive.Migrations
b.HasIndex("MemberId");
b.ToTable("Loans");
b.HasData(
new
{
Id = 1,
BookId = 1,
DueDate = new DateOnly(2025, 12, 15),
LoanDate = new DateOnly(2025, 12, 1),
MemberId = 1,
ReturnDate = new DateOnly(2025, 12, 10)
},
new
{
Id = 2,
BookId = 2,
DueDate = new DateOnly(2025, 12, 20),
LoanDate = new DateOnly(2025, 12, 5),
MemberId = 2,
ReturnDate = new DateOnly(2025, 12, 18)
},
new
{
Id = 3,
BookId = 3,
DueDate = new DateOnly(2025, 12, 25),
LoanDate = new DateOnly(2025, 12, 10),
MemberId = 3
},
new
{
Id = 4,
BookId = 4,
DueDate = new DateOnly(2025, 12, 27),
LoanDate = new DateOnly(2025, 12, 12),
MemberId = 1
},
new
{
Id = 5,
BookId = 5,
DueDate = new DateOnly(2025, 11, 15),
LoanDate = new DateOnly(2025, 11, 1),
MemberId = 2,
ReturnDate = new DateOnly(2025, 11, 14)
});
});
modelBuilder.Entity("BookHive.Models.Member", b =>
@@ -162,6 +304,44 @@ namespace BookHive.Migrations
b.HasKey("Id");
b.ToTable("Members");
b.HasData(
new
{
Id = 1,
Email = "alice@example.com",
FirstName = "Alice",
IsActive = true,
LastName = "Martin",
MembershipDate = new DateOnly(2023, 1, 10)
},
new
{
Id = 2,
Email = "bob@example.com",
FirstName = "Bob",
IsActive = true,
LastName = "Durand",
MembershipDate = new DateOnly(2023, 5, 12)
},
new
{
Id = 3,
Email = "claire@example.com",
FirstName = "Claire",
IsActive = true,
LastName = "Petit",
MembershipDate = new DateOnly(2024, 2, 2)
},
new
{
Id = 4,
Email = "david@example.com",
FirstName = "David",
IsActive = true,
LastName = "Bernard",
MembershipDate = new DateOnly(2024, 6, 15)
});
});
modelBuilder.Entity("BookHive.Models.Review", b =>
@@ -179,8 +359,7 @@ namespace BookHive.Migrations
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime?>("CreatedAt")
.IsRequired()
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<int>("MemberId")
@@ -197,6 +376,44 @@ namespace BookHive.Migrations
.IsUnique();
b.ToTable("Reviews");
b.HasData(
new
{
Id = 1,
BookId = 1,
Comment = "Un chef-d'œuvre dystopique.",
CreatedAt = new DateTime(2025, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 1,
Rating = 5
},
new
{
Id = 2,
BookId = 3,
Comment = "Très bon roman classique.",
CreatedAt = new DateTime(2025, 12, 2, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 2,
Rating = 4
},
new
{
Id = 3,
BookId = 5,
Comment = "Incroyable roman historique.",
CreatedAt = new DateTime(2025, 12, 3, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 3,
Rating = 5
},
new
{
Id = 4,
BookId = 2,
Comment = "Drôle et intelligent.",
CreatedAt = new DateTime(2025, 12, 4, 0, 0, 0, 0, DateTimeKind.Unspecified),
MemberId = 4,
Rating = 4
});
});
modelBuilder.Entity("BookHive.Models.Book", b =>