@ -8,13 +8,13 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DataBase.Migrations
namespace DataBase.Migrations
{
{
/// <inheritdoc />
/// <inheritdoc />
public partial class initM igration : Migration
public partial class mym igration : Migration
{
{
/// <inheritdoc />
/// <inheritdoc />
protected override void Up ( MigrationBuilder migrationBuilder )
protected override void Up ( MigrationBuilder migrationBuilder )
{
{
migrationBuilder . CreateTable (
migrationBuilder . CreateTable (
name : "Player ",
name : "Player s ",
columns : table = > new
columns : table = > new
{
{
playerId = table . Column < int > ( type : "INTEGER" , nullable : false )
playerId = table . Column < int > ( type : "INTEGER" , nullable : false )
@ -25,11 +25,11 @@ namespace DataBase.Migrations
} ,
} ,
constraints : table = >
constraints : table = >
{
{
table . PrimaryKey ( "PK_Player ", x = > x . playerId ) ;
table . PrimaryKey ( "PK_Player s ", x = > x . playerId ) ;
} ) ;
} ) ;
migrationBuilder . CreateTable (
migrationBuilder . CreateTable (
name : "Chat ",
name : "Chat s ",
columns : table = > new
columns : table = > new
{
{
chatId = table . Column < int > ( type : "INTEGER" , nullable : false )
chatId = table . Column < int > ( type : "INTEGER" , nullable : false )
@ -39,23 +39,23 @@ namespace DataBase.Migrations
} ,
} ,
constraints : table = >
constraints : table = >
{
{
table . PrimaryKey ( "PK_Chat ", x = > x . chatId ) ;
table . PrimaryKey ( "PK_Chat s ", x = > x . chatId ) ;
table . ForeignKey (
table . ForeignKey (
name : "FK_Chat _Player_player1",
name : "FK_Chat s _Players _player1",
column : x = > x . player1 ,
column : x = > x . player1 ,
principalTable : "Player ",
principalTable : "Player s ",
principalColumn : "playerId" ,
principalColumn : "playerId" ,
onDelete : ReferentialAction . Cascade ) ;
onDelete : ReferentialAction . Cascade ) ;
table . ForeignKey (
table . ForeignKey (
name : "FK_Chat _Player_player2",
name : "FK_Chat s _Players _player2",
column : x = > x . player2 ,
column : x = > x . player2 ,
principalTable : "Player ",
principalTable : "Player s ",
principalColumn : "playerId" ,
principalColumn : "playerId" ,
onDelete : ReferentialAction . Cascade ) ;
onDelete : ReferentialAction . Cascade ) ;
} ) ;
} ) ;
migrationBuilder . CreateTable (
migrationBuilder . CreateTable (
name : "Game ",
name : "Game s ",
columns : table = > new
columns : table = > new
{
{
gameId = table . Column < int > ( type : "INTEGER" , nullable : false )
gameId = table . Column < int > ( type : "INTEGER" , nullable : false )
@ -67,23 +67,23 @@ namespace DataBase.Migrations
} ,
} ,
constraints : table = >
constraints : table = >
{
{
table . PrimaryKey ( "PK_Game ", x = > x . gameId ) ;
table . PrimaryKey ( "PK_Game s ", x = > x . gameId ) ;
table . ForeignKey (
table . ForeignKey (
name : "FK_Game _Player_loser",
name : "FK_Game s _Players _loser",
column : x = > x . loser ,
column : x = > x . loser ,
principalTable : "Player ",
principalTable : "Player s ",
principalColumn : "playerId" ,
principalColumn : "playerId" ,
onDelete : ReferentialAction . Cascade ) ;
onDelete : ReferentialAction . Cascade ) ;
table . ForeignKey (
table . ForeignKey (
name : "FK_Game _Player_winner",
name : "FK_Game s _Players _winner",
column : x = > x . winner ,
column : x = > x . winner ,
principalTable : "Player ",
principalTable : "Player s ",
principalColumn : "playerId" ,
principalColumn : "playerId" ,
onDelete : ReferentialAction . Cascade ) ;
onDelete : ReferentialAction . Cascade ) ;
} ) ;
} ) ;
migrationBuilder . CreateTable (
migrationBuilder . CreateTable (
name : "Message ",
name : "Message s ",
columns : table = > new
columns : table = > new
{
{
messageId = table . Column < int > ( type : "INTEGER" , nullable : false )
messageId = table . Column < int > ( type : "INTEGER" , nullable : false )
@ -95,23 +95,23 @@ namespace DataBase.Migrations
} ,
} ,
constraints : table = >
constraints : table = >
{
{
table . PrimaryKey ( "PK_Message ", x = > x . messageId ) ;
table . PrimaryKey ( "PK_Message s ", x = > x . messageId ) ;
table . ForeignKey (
table . ForeignKey (
name : "FK_Message _Chat_chat",
name : "FK_Message s _Chats _chat",
column : x = > x . chat ,
column : x = > x . chat ,
principalTable : "Chat ",
principalTable : "Chat s ",
principalColumn : "chatId" ,
principalColumn : "chatId" ,
onDelete : ReferentialAction . Cascade ) ;
onDelete : ReferentialAction . Cascade ) ;
table . ForeignKey (
table . ForeignKey (
name : "FK_Message _Player_player",
name : "FK_Message s _Players _player",
column : x = > x . player ,
column : x = > x . player ,
principalTable : "Player ",
principalTable : "Player s ",
principalColumn : "playerId" ,
principalColumn : "playerId" ,
onDelete : ReferentialAction . Cascade ) ;
onDelete : ReferentialAction . Cascade ) ;
} ) ;
} ) ;
migrationBuilder . InsertData (
migrationBuilder . InsertData (
table : "Player ",
table : "Player s ",
columns : new [ ] { "playerId" , "name" , "nbBallTouchTotal" , "timePlayed" } ,
columns : new [ ] { "playerId" , "name" , "nbBallTouchTotal" , "timePlayed" } ,
values : new object [ , ]
values : new object [ , ]
{
{
@ -120,17 +120,17 @@ namespace DataBase.Migrations
} ) ;
} ) ;
migrationBuilder . InsertData (
migrationBuilder . InsertData (
table : "Chat ",
table : "Chat s ",
columns : new [ ] { "chatId" , "player1" , "player2" } ,
columns : new [ ] { "chatId" , "player1" , "player2" } ,
values : new object [ ] { 1 , 1 , 2 } ) ;
values : new object [ ] { 1 , 1 , 2 } ) ;
migrationBuilder . InsertData (
migrationBuilder . InsertData (
table : "Game ",
table : "Game s ",
columns : new [ ] { "gameId" , "durationGame" , "loser" , "nbMaxEchanges" , "winner" } ,
columns : new [ ] { "gameId" , "durationGame" , "loser" , "nbMaxEchanges" , "winner" } ,
values : new object [ ] { 1 , 65 , 2 , 5 , 1 } ) ;
values : new object [ ] { 1 , 65 , 2 , 5 , 1 } ) ;
migrationBuilder . InsertData (
migrationBuilder . InsertData (
table : "Message ",
table : "Message s ",
columns : new [ ] { "messageId" , "chat" , "message" , "player" , "timestamp" } ,
columns : new [ ] { "messageId" , "chat" , "message" , "player" , "timestamp" } ,
values : new object [ , ]
values : new object [ , ]
{
{
@ -139,33 +139,33 @@ namespace DataBase.Migrations
} ) ;
} ) ;
migrationBuilder . CreateIndex (
migrationBuilder . CreateIndex (
name : "IX_Chat _player1",
name : "IX_Chat s _player1",
table : "Chat ",
table : "Chat s ",
column : "player1" ) ;
column : "player1" ) ;
migrationBuilder . CreateIndex (
migrationBuilder . CreateIndex (
name : "IX_Chat _player2",
name : "IX_Chat s _player2",
table : "Chat ",
table : "Chat s ",
column : "player2" ) ;
column : "player2" ) ;
migrationBuilder . CreateIndex (
migrationBuilder . CreateIndex (
name : "IX_Game _loser",
name : "IX_Game s _loser",
table : "Game ",
table : "Game s ",
column : "loser" ) ;
column : "loser" ) ;
migrationBuilder . CreateIndex (
migrationBuilder . CreateIndex (
name : "IX_Game _winner",
name : "IX_Game s _winner",
table : "Game ",
table : "Game s ",
column : "winner" ) ;
column : "winner" ) ;
migrationBuilder . CreateIndex (
migrationBuilder . CreateIndex (
name : "IX_Message _chat",
name : "IX_Message s _chat",
table : "Message ",
table : "Message s ",
column : "chat" ) ;
column : "chat" ) ;
migrationBuilder . CreateIndex (
migrationBuilder . CreateIndex (
name : "IX_Message _player",
name : "IX_Message s _player",
table : "Message ",
table : "Message s ",
column : "player" ) ;
column : "player" ) ;
}
}
@ -173,16 +173,16 @@ namespace DataBase.Migrations
protected override void Down ( MigrationBuilder migrationBuilder )
protected override void Down ( MigrationBuilder migrationBuilder )
{
{
migrationBuilder . DropTable (
migrationBuilder . DropTable (
name : "Game ") ;
name : "Game s ") ;
migrationBuilder . DropTable (
migrationBuilder . DropTable (
name : "Message ") ;
name : "Message s ") ;
migrationBuilder . DropTable (
migrationBuilder . DropTable (
name : "Chat ") ;
name : "Chat s ") ;
migrationBuilder . DropTable (
migrationBuilder . DropTable (
name : "Player ") ;
name : "Player s ") ;
}
}
}
}
}
}