@ -1,6 +1,5 @@
using System ;
using Microsoft.EntityFrameworkCore.Migrations ;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata ;
#nullable disable
@ -9,7 +8,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace StubbedContextLib.Migrations
{
/// <inheritdoc />
public partial class myFirstMigration : Migration
public partial class pm_api : Migration
{
/// <inheritdoc />
protected override void Up ( MigrationBuilder migrationBuilder )
@ -18,9 +17,9 @@ namespace StubbedContextLib.Migrations
name : "images" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
ImgPath = table . Column < string > ( type : " text ", nullable : false )
Id = table . Column < int > ( type : "int ", nullable : false )
. Annotation ( " SqlServer:Identity", "1, 1" ) ,
ImgPath = table . Column < string > ( type : " nvarchar(max) ", nullable : false )
} ,
constraints : table = >
{
@ -31,15 +30,15 @@ namespace StubbedContextLib.Migrations
name : "question" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
Text = table . Column < string > ( type : " character varying (200)", maxLength : 200 , nullable : false ) ,
AnswerA = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
AnswerB = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
AnswerC = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
AnswerD = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
CorrectAnswer = table . Column < string > ( type : " character varying (1)", maxLength : 1 , nullable : false ) ,
IsValid = table . Column < bool > ( type : "b oolean ", nullable : false )
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 : "b it ", nullable : false )
} ,
constraints : table = >
{
@ -50,11 +49,11 @@ namespace StubbedContextLib.Migrations
name : "sources" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
Title = table . Column < string > ( type : " character varying (100)", maxLength : 100 , nullable : false ) ,
Year = table . Column < int > ( type : "int eger ", nullable : false ) ,
TypeSrc = table . Column < int > ( type : "int eger ", nullable : false )
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 )
} ,
constraints : table = >
{
@ -65,10 +64,10 @@ namespace StubbedContextLib.Migrations
name : "characters" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
Name = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
IdImage = table . Column < int > ( type : "int eger ", nullable : false )
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 )
} ,
constraints : table = >
{
@ -85,11 +84,11 @@ namespace StubbedContextLib.Migrations
name : "quizzes" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
Title = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
IdImage = table . Column < int > ( type : "int eger ", nullable : false ) ,
NbQuestion = table . Column < int > ( type : "int eger ", nullable : false )
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 )
} ,
constraints : table = >
{
@ -106,12 +105,12 @@ namespace StubbedContextLib.Migrations
name : "users" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
UserName = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
Email = table . Column < string > ( type : " character varying (50)", maxLength : 50 , nullable : false ) ,
Password = table . Column < string > ( type : " character varying (200)", maxLength : 200 , nullable : false ) ,
IdImage = table . Column < int > ( type : "int eger ", nullable : false ) ,
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 ) ,
Created = table . Column < DateTime > ( type : "date" , nullable : false )
} ,
constraints : table = >
@ -129,8 +128,8 @@ namespace StubbedContextLib.Migrations
name : "QuizQuestion" ,
columns : table = > new
{
IdQuiz = table . Column < int > ( type : "int eger ", nullable : false ) ,
IdQuestion = table . Column < int > ( type : "int eger ", nullable : false )
IdQuiz = table . Column < int > ( type : "int ", nullable : false ) ,
IdQuestion = table . Column < int > ( type : "int ", nullable : false )
} ,
constraints : table = >
{
@ -153,9 +152,9 @@ namespace StubbedContextLib.Migrations
name : "admins" ,
columns : table = > new
{
IdUsers = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
UserId = table . Column < int > ( type : "int eger ", nullable : false )
IdUsers = table . Column < int > ( type : "int ", nullable : false )
. Annotation ( " SqlServer:Identity", "1, 1" ) ,
UserId = table . Column < int > ( type : "int ", nullable : false )
} ,
constraints : table = >
{
@ -172,15 +171,15 @@ namespace StubbedContextLib.Migrations
name : "quotes" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
Content = table . Column < string > ( type : " character varying (100)", maxLength : 100 , nullable : false ) ,
Likes = table . Column < int > ( type : "int eger ", nullable : false ) ,
Langage = table . Column < int > ( type : "int eger ", nullable : false ) ,
IsValid = table . Column < bool > ( type : "b oolean ", nullable : false ) ,
IdCharacter = table . Column < int > ( type : "int eger ", nullable : false ) ,
IdSource = table . Column < int > ( type : "int eger ", nullable : false ) ,
IdUsersPropose = table . Column < int > ( type : "int eger ", nullable : true )
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 : "b it ", 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 )
} ,
constraints : table = >
{
@ -208,16 +207,16 @@ namespace StubbedContextLib.Migrations
name : "comments" ,
columns : table = > new
{
Id = table . Column < int > ( type : "int eger ", nullable : false )
. Annotation ( "Npgsql:ValueGenerationStrategy" , NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
Id User = table . Column < int > ( type : "int eger ", nullable : false ) ,
IdQuote = table . Column < int > ( type : "integer" , nullable : false ) ,
Id User = 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" ) ,
DateCommentary = table . Column < DateTime > ( type : "date" , nullable : false ) ,
Comment = table . Column < string > ( type : " character varying (100)", maxLength : 100 , nullable : false )
Comment = table . Column < string > ( type : " nvarchar (100)", maxLength : 100 , nullable : false )
} ,
constraints : table = >
{
table . PrimaryKey ( "PK_comments" , x = > x . Id ) ;
table . PrimaryKey ( "PK_comments" , x = > new { x . Id User, x . IdQuote } ) ;
table . ForeignKey (
name : "FK_comments_quotes_IdQuote" ,
column : x = > x . IdQuote ,
@ -235,8 +234,8 @@ namespace StubbedContextLib.Migrations
name : "favorites" ,
columns : table = > new
{
IdUsers = table . Column < int > ( type : "int eger ", nullable : false ) ,
IdQuote = table . Column < int > ( type : "int eger ", nullable : false )
IdUsers = table . Column < int > ( type : "int ", nullable : false ) ,
IdQuote = table . Column < int > ( type : "int ", nullable : false )
} ,
constraints : table = >
{
@ -378,11 +377,11 @@ namespace StubbedContextLib.Migrations
migrationBuilder . InsertData (
table : "comments" ,
columns : new [ ] { "Id ", "Comment" , "DateCommentary" , "Id Quote", "IdUser " } ,
columns : new [ ] { "Id Quote", "IdUser ", "Comment" , "DateCommentary" , "Id " } ,
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 }
{ 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 }
} ) ;
migrationBuilder . InsertData (
@ -416,11 +415,6 @@ 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" ,