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