493 lines
18 KiB
C#
493 lines
18 KiB
C#
// <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
|
|
}
|
|
}
|
|
}
|