Bdd8 SQLite

master
Leni BEAULATON 2 weeks ago
parent d1f802a002
commit f125ebc9fd

File diff suppressed because it is too large Load Diff

@ -1,86 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace StubbedContextLib.Migrations
{
/// <inheritdoc />
public partial class pm_apiV2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_comments",
table: "comments");
migrationBuilder.DeleteData(
table: "comments",
keyColumns: new[] { "IdQuote", "IdUser" },
keyValues: new object[] { 1, 2 });
migrationBuilder.DeleteData(
table: "comments",
keyColumns: new[] { "IdQuote", "IdUser" },
keyValues: new object[] { 1, 3 });
migrationBuilder.AddPrimaryKey(
name: "PK_comments",
table: "comments",
column: "Id");
migrationBuilder.InsertData(
table: "comments",
columns: new[] { "Id", "Comment", "DateCommentary", "IdQuote", "IdUser" },
values: new object[,]
{
{ 1, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 2 },
{ 2, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 3 }
});
migrationBuilder.CreateIndex(
name: "IX_comments_IdUser",
table: "comments",
column: "IdUser");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_comments",
table: "comments");
migrationBuilder.DropIndex(
name: "IX_comments_IdUser",
table: "comments");
migrationBuilder.DeleteData(
table: "comments",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "comments",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.AddPrimaryKey(
name: "PK_comments",
table: "comments",
columns: new[] { "IdUser", "IdQuote" });
migrationBuilder.InsertData(
table: "comments",
columns: new[] { "IdQuote", "IdUser", "Comment", "DateCommentary", "Id" },
values: new object[,]
{
{ 1, 2, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1 },
{ 1, 3, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 2 }
});
}
}
}

@ -2,7 +2,6 @@
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using StubbedContextLib; using StubbedContextLib;
@ -12,29 +11,23 @@ using StubbedContextLib;
namespace StubbedContextLib.Migrations namespace StubbedContextLib.Migrations
{ {
[DbContext(typeof(StubWTFContext))] [DbContext(typeof(StubWTFContext))]
[Migration("20250402134601_pm_apiV2")] [Migration("20250403144039_myFirstMigration")]
partial class pm_apiV2 partial class myFirstMigration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entity.Admin", b => modelBuilder.Entity("Entity.Admin", b =>
{ {
b.Property<int>("IdUsers") b.Property<int>("IdUsers")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdUsers"));
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("IdUsers"); b.HasKey("IdUsers");
@ -47,17 +40,15 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage") b.Property<int>("IdImage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -132,24 +123,22 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Comment") b.Property<string>("Comment")
.IsRequired() .IsRequired()
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("TEXT");
b.Property<DateTime>("DateCommentary") b.Property<DateTime>("DateCommentary")
.HasColumnType("date") .HasColumnType("date")
.HasColumnName("DateCommentary"); .HasColumnName("DateCommentary");
b.Property<int>("IdQuote") b.Property<int>("IdQuote")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdUser") b.Property<int>("IdUser")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("Id"); b.HasKey("Id");
@ -181,10 +170,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.Favorite", b => modelBuilder.Entity("Entity.Favorite", b =>
{ {
b.Property<int>("IdQuote") b.Property<int>("IdQuote")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdUsers") b.Property<int>("IdUsers")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("IdQuote", "IdUsers"); b.HasKey("IdQuote", "IdUsers");
@ -244,13 +233,11 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImgPath") b.Property<string>("ImgPath")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -313,42 +300,40 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AnswerA") b.Property<string>("AnswerA")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("AnswerB") b.Property<string>("AnswerB")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("AnswerC") b.Property<string>("AnswerC")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("AnswerD") b.Property<string>("AnswerD")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("CorrectAnswer") b.Property<string>("CorrectAnswer")
.IsRequired() .IsRequired()
.HasMaxLength(1) .HasMaxLength(1)
.HasColumnType("nvarchar(1)"); .HasColumnType("TEXT");
b.Property<bool>("IsValid") b.Property<bool>("IsValid")
.HasColumnType("bit"); .HasColumnType("INTEGER");
b.Property<string>("Text") b.Property<string>("Text")
.IsRequired() .IsRequired()
.HasMaxLength(200) .HasMaxLength(200)
.HasColumnType("nvarchar(200)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -471,20 +456,18 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage") b.Property<int>("IdImage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("NbQuestion") b.Property<int>("NbQuestion")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -512,10 +495,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.QuizQuestion", b => modelBuilder.Entity("Entity.QuizQuestion", b =>
{ {
b.Property<int>("IdQuestion") b.Property<int>("IdQuestion")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdQuiz") b.Property<int>("IdQuiz")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("IdQuestion", "IdQuiz"); b.HasKey("IdQuestion", "IdQuiz");
@ -580,32 +563,30 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content") b.Property<string>("Content")
.IsRequired() .IsRequired()
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("TEXT");
b.Property<int>("IdCharacter") b.Property<int>("IdCharacter")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdSource") b.Property<int>("IdSource")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int?>("IdUsersPropose") b.Property<int?>("IdUsersPropose")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<bool>("IsValid") b.Property<bool>("IsValid")
.HasColumnType("bit"); .HasColumnType("INTEGER");
b.Property<int>("Langage") b.Property<int>("Langage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("Likes") b.Property<int>("Likes")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("Id"); b.HasKey("Id");
@ -734,20 +715,18 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("TEXT");
b.Property<int>("TypeSrc") b.Property<int>("TypeSrc")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("Year") b.Property<int>("Year")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("Id"); b.HasKey("Id");
@ -795,9 +774,7 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created") b.Property<DateTime>("Created")
.HasColumnType("date") .HasColumnType("date")
@ -806,20 +783,20 @@ namespace StubbedContextLib.Migrations
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<int>("IdImage") b.Property<int>("IdImage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<string>("Password") b.Property<string>("Password")
.IsRequired() .IsRequired()
.HasMaxLength(200) .HasMaxLength(200)
.HasColumnType("nvarchar(200)"); .HasColumnType("TEXT");
b.Property<string>("UserName") b.Property<string>("UserName")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");

@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace StubbedContextLib.Migrations namespace StubbedContextLib.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class pm_api : Migration public partial class myFirstMigration : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@ -17,9 +17,9 @@ namespace StubbedContextLib.Migrations
name: "images", name: "images",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
ImgPath = table.Column<string>(type: "nvarchar(max)", nullable: false) ImgPath = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -30,15 +30,15 @@ namespace StubbedContextLib.Migrations
name: "question", name: "question",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
Text = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), Text = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
AnswerA = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), AnswerA = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
AnswerB = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), AnswerB = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
AnswerC = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), AnswerC = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
AnswerD = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), AnswerD = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
CorrectAnswer = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false), CorrectAnswer = table.Column<string>(type: "TEXT", maxLength: 1, nullable: false),
IsValid = table.Column<bool>(type: "bit", nullable: false) IsValid = table.Column<bool>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -49,11 +49,11 @@ namespace StubbedContextLib.Migrations
name: "sources", name: "sources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
Title = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), Title = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Year = table.Column<int>(type: "int", nullable: false), Year = table.Column<int>(type: "INTEGER", nullable: false),
TypeSrc = table.Column<int>(type: "int", nullable: false) TypeSrc = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -64,10 +64,10 @@ namespace StubbedContextLib.Migrations
name: "characters", name: "characters",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
IdImage = table.Column<int>(type: "int", nullable: false) IdImage = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -84,11 +84,11 @@ namespace StubbedContextLib.Migrations
name: "quizzes", name: "quizzes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
Title = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), Title = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
IdImage = table.Column<int>(type: "int", nullable: false), IdImage = table.Column<int>(type: "INTEGER", nullable: false),
NbQuestion = table.Column<int>(type: "int", nullable: false) NbQuestion = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -105,12 +105,12 @@ namespace StubbedContextLib.Migrations
name: "users", name: "users",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), UserName = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), Email = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Password = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), Password = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
IdImage = table.Column<int>(type: "int", nullable: false), IdImage = table.Column<int>(type: "INTEGER", nullable: false),
Created = table.Column<DateTime>(type: "date", nullable: false) Created = table.Column<DateTime>(type: "date", nullable: false)
}, },
constraints: table => constraints: table =>
@ -128,8 +128,8 @@ namespace StubbedContextLib.Migrations
name: "QuizQuestion", name: "QuizQuestion",
columns: table => new columns: table => new
{ {
IdQuiz = table.Column<int>(type: "int", nullable: false), IdQuiz = table.Column<int>(type: "INTEGER", nullable: false),
IdQuestion = table.Column<int>(type: "int", nullable: false) IdQuestion = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -152,9 +152,9 @@ namespace StubbedContextLib.Migrations
name: "admins", name: "admins",
columns: table => new columns: table => new
{ {
IdUsers = table.Column<int>(type: "int", nullable: false) IdUsers = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
UserId = table.Column<int>(type: "int", nullable: false) UserId = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -171,15 +171,15 @@ namespace StubbedContextLib.Migrations
name: "quotes", name: "quotes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Sqlite:Autoincrement", true),
Content = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), Content = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Likes = table.Column<int>(type: "int", nullable: false), Likes = table.Column<int>(type: "INTEGER", nullable: false),
Langage = table.Column<int>(type: "int", nullable: false), Langage = table.Column<int>(type: "INTEGER", nullable: false),
IsValid = table.Column<bool>(type: "bit", nullable: false), IsValid = table.Column<bool>(type: "INTEGER", nullable: false),
IdCharacter = table.Column<int>(type: "int", nullable: false), IdCharacter = table.Column<int>(type: "INTEGER", nullable: false),
IdSource = table.Column<int>(type: "int", nullable: false), IdSource = table.Column<int>(type: "INTEGER", nullable: false),
IdUsersPropose = table.Column<int>(type: "int", nullable: true) IdUsersPropose = table.Column<int>(type: "INTEGER", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -207,16 +207,16 @@ namespace StubbedContextLib.Migrations
name: "comments", name: "comments",
columns: table => new columns: table => new
{ {
IdUser = table.Column<int>(type: "int", nullable: false), Id = table.Column<int>(type: "INTEGER", nullable: false)
IdQuote = table.Column<int>(type: "int", nullable: false), .Annotation("Sqlite:Autoincrement", true),
Id = table.Column<int>(type: "int", nullable: false) IdUser = table.Column<int>(type: "INTEGER", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"), IdQuote = table.Column<int>(type: "INTEGER", nullable: false),
DateCommentary = table.Column<DateTime>(type: "date", nullable: false), DateCommentary = table.Column<DateTime>(type: "date", nullable: false),
Comment = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false) Comment = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_comments", x => new { x.IdUser, x.IdQuote }); table.PrimaryKey("PK_comments", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_comments_quotes_IdQuote", name: "FK_comments_quotes_IdQuote",
column: x => x.IdQuote, column: x => x.IdQuote,
@ -234,8 +234,8 @@ namespace StubbedContextLib.Migrations
name: "favorites", name: "favorites",
columns: table => new columns: table => new
{ {
IdUsers = table.Column<int>(type: "int", nullable: false), IdUsers = table.Column<int>(type: "INTEGER", nullable: false),
IdQuote = table.Column<int>(type: "int", nullable: false) IdQuote = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -377,11 +377,11 @@ namespace StubbedContextLib.Migrations
migrationBuilder.InsertData( migrationBuilder.InsertData(
table: "comments", table: "comments",
columns: new[] { "IdQuote", "IdUser", "Comment", "DateCommentary", "Id" }, columns: new[] { "Id", "Comment", "DateCommentary", "IdQuote", "IdUser" },
values: new object[,] values: new object[,]
{ {
{ 1, 2, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1 }, { 1, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 2 },
{ 1, 3, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 2 } { 2, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 3 }
}); });
migrationBuilder.InsertData( migrationBuilder.InsertData(
@ -415,6 +415,11 @@ namespace StubbedContextLib.Migrations
table: "comments", table: "comments",
column: "IdQuote"); column: "IdQuote");
migrationBuilder.CreateIndex(
name: "IX_comments_IdUser",
table: "comments",
column: "IdUser");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_favorites_IdUsers", name: "IX_favorites_IdUsers",
table: "favorites", table: "favorites",

@ -2,7 +2,6 @@
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using StubbedContextLib; using StubbedContextLib;
@ -16,22 +15,16 @@ namespace StubbedContextLib.Migrations
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entity.Admin", b => modelBuilder.Entity("Entity.Admin", b =>
{ {
b.Property<int>("IdUsers") b.Property<int>("IdUsers")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdUsers"));
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("IdUsers"); b.HasKey("IdUsers");
@ -44,17 +37,15 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage") b.Property<int>("IdImage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -129,24 +120,22 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Comment") b.Property<string>("Comment")
.IsRequired() .IsRequired()
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("TEXT");
b.Property<DateTime>("DateCommentary") b.Property<DateTime>("DateCommentary")
.HasColumnType("date") .HasColumnType("date")
.HasColumnName("DateCommentary"); .HasColumnName("DateCommentary");
b.Property<int>("IdQuote") b.Property<int>("IdQuote")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdUser") b.Property<int>("IdUser")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("Id"); b.HasKey("Id");
@ -178,10 +167,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.Favorite", b => modelBuilder.Entity("Entity.Favorite", b =>
{ {
b.Property<int>("IdQuote") b.Property<int>("IdQuote")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdUsers") b.Property<int>("IdUsers")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("IdQuote", "IdUsers"); b.HasKey("IdQuote", "IdUsers");
@ -241,13 +230,11 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImgPath") b.Property<string>("ImgPath")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -310,42 +297,40 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AnswerA") b.Property<string>("AnswerA")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("AnswerB") b.Property<string>("AnswerB")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("AnswerC") b.Property<string>("AnswerC")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("AnswerD") b.Property<string>("AnswerD")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<string>("CorrectAnswer") b.Property<string>("CorrectAnswer")
.IsRequired() .IsRequired()
.HasMaxLength(1) .HasMaxLength(1)
.HasColumnType("nvarchar(1)"); .HasColumnType("TEXT");
b.Property<bool>("IsValid") b.Property<bool>("IsValid")
.HasColumnType("bit"); .HasColumnType("INTEGER");
b.Property<string>("Text") b.Property<string>("Text")
.IsRequired() .IsRequired()
.HasMaxLength(200) .HasMaxLength(200)
.HasColumnType("nvarchar(200)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -468,20 +453,18 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage") b.Property<int>("IdImage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("NbQuestion") b.Property<int>("NbQuestion")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -509,10 +492,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.QuizQuestion", b => modelBuilder.Entity("Entity.QuizQuestion", b =>
{ {
b.Property<int>("IdQuestion") b.Property<int>("IdQuestion")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdQuiz") b.Property<int>("IdQuiz")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("IdQuestion", "IdQuiz"); b.HasKey("IdQuestion", "IdQuiz");
@ -577,32 +560,30 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content") b.Property<string>("Content")
.IsRequired() .IsRequired()
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("TEXT");
b.Property<int>("IdCharacter") b.Property<int>("IdCharacter")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("IdSource") b.Property<int>("IdSource")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int?>("IdUsersPropose") b.Property<int?>("IdUsersPropose")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<bool>("IsValid") b.Property<bool>("IsValid")
.HasColumnType("bit"); .HasColumnType("INTEGER");
b.Property<int>("Langage") b.Property<int>("Langage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("Likes") b.Property<int>("Likes")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("Id"); b.HasKey("Id");
@ -731,20 +712,18 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("TEXT");
b.Property<int>("TypeSrc") b.Property<int>("TypeSrc")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<int>("Year") b.Property<int>("Year")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.HasKey("Id"); b.HasKey("Id");
@ -792,9 +771,7 @@ namespace StubbedContextLib.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("INTEGER");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created") b.Property<DateTime>("Created")
.HasColumnType("date") .HasColumnType("date")
@ -803,20 +780,20 @@ namespace StubbedContextLib.Migrations
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.Property<int>("IdImage") b.Property<int>("IdImage")
.HasColumnType("int"); .HasColumnType("INTEGER");
b.Property<string>("Password") b.Property<string>("Password")
.IsRequired() .IsRequired()
.HasMaxLength(200) .HasMaxLength(200)
.HasColumnType("nvarchar(200)"); .HasColumnType("TEXT");
b.Property<string>("UserName") b.Property<string>("UserName")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");

Loading…
Cancel
Save