@ -1,5 +1,6 @@
using System ;
using Microsoft.EntityFrameworkCore.Migrations ;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata ;
#nullable disable
@ -8,7 +9,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 +18,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 : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
ImgPath = table . Column < string > ( type : " text ", nullable : false )
} ,
constraints : table = >
{
@ -30,15 +31,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 : "b it ", nullable : false )
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 )
} ,
constraints : table = >
{
@ -49,11 +50,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 : "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 )
} ,
constraints : table = >
{
@ -64,10 +65,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 : "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 )
} ,
constraints : table = >
{
@ -84,11 +85,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 : "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 )
} ,
constraints : table = >
{
@ -105,12 +106,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 : "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 ) ,
Created = table . Column < DateTime > ( type : "date" , nullable : false )
} ,
constraints : table = >
@ -128,8 +129,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 : "int eger ", nullable : false ) ,
IdQuestion = table . Column < int > ( type : "int eger ", nullable : false )
} ,
constraints : table = >
{
@ -152,9 +153,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 : "int eger ", nullable : false )
. Annotation ( " Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy . IdentityByDefaultColumn ) ,
UserId = table . Column < int > ( type : "int eger ", nullable : false )
} ,
constraints : table = >
{
@ -171,15 +172,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 : "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 )
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 )
} ,
constraints : table = >
{
@ -207,16 +208,16 @@ namespace StubbedContextLib.Migrations
name : "comments" ,
columns : table = > new
{
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" ) ,
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 ) ,
DateCommentary = table . Column < DateTime > ( type : "date" , nullable : false ) ,
Comment = table . Column < string > ( type : " nvarchar (100)", maxLength : 100 , nullable : false )
Comment = table . Column < string > ( type : " character varying (100)", maxLength : 100 , nullable : false )
} ,
constraints : table = >
{
table . PrimaryKey ( "PK_comments" , x = > new { x . Id User, x . IdQuote } ) ;
table . PrimaryKey ( "PK_comments" , x = > x . Id ) ;
table . ForeignKey (
name : "FK_comments_quotes_IdQuote" ,
column : x = > x . IdQuote ,
@ -234,8 +235,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 : "int eger ", nullable : false ) ,
IdQuote = table . Column < int > ( type : "int eger ", nullable : false )
} ,
constraints : table = >
{
@ -377,11 +378,11 @@ namespace StubbedContextLib.Migrations
migrationBuilder . InsertData (
table : "comments" ,
columns : new [ ] { "Id Quote", "IdUser ", "Comment" , "DateCommentary" , "Id " } ,
columns : new [ ] { "Id ", "Comment" , "DateCommentary" , "Id Quote", "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 +416,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" ,