diff --git a/code/server/DataBase/Context/PongDbContext.cs b/code/server/DataBase/Context/PongDbContext.cs
index 8b270cb..bb31aef 100644
--- a/code/server/DataBase/Context/PongDbContext.cs
+++ b/code/server/DataBase/Context/PongDbContext.cs
@@ -21,6 +21,7 @@ namespace DataBase.Context
if (!optionsBuilder.IsConfigured)
{
+ //optionsBuilder.UseNpgsql(@"host=localhost;database=postgres;user id=postgres;password=1234;");
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..\\..\\..\\..\\DataBase\\PongDB.db");
optionsBuilder.UseSqlite($"Data Source={path}");
}
diff --git a/code/server/DataBase/Migrations/20230316092529_mymigrations.Designer.cs b/code/server/DataBase/Migrations/20230316103854_mymigrations.Designer.cs
similarity index 71%
rename from code/server/DataBase/Migrations/20230316092529_mymigrations.Designer.cs
rename to code/server/DataBase/Migrations/20230316103854_mymigrations.Designer.cs
index 081b26f..a4dc3b0 100644
--- a/code/server/DataBase/Migrations/20230316092529_mymigrations.Designer.cs
+++ b/code/server/DataBase/Migrations/20230316103854_mymigrations.Designer.cs
@@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DataBase.Migrations
{
- [DbContext(typeof(PongDbContextWithStub))]
- [Migration("20230316092529_mymigrations")]
+ [DbContext(typeof(PongDbContext))]
+ [Migration("20230316103854_mymigrations")]
partial class mymigrations
{
///
@@ -40,15 +40,7 @@ namespace DataBase.Migrations
b.HasIndex("player2");
- b.ToTable("Chats");
-
- b.HasData(
- new
- {
- chatId = 1,
- player1 = "test",
- player2 = "test2"
- });
+ b.ToTable("Chats", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Game", b =>
@@ -83,19 +75,7 @@ namespace DataBase.Migrations
b.HasIndex("winner");
- b.ToTable("Games");
-
- b.HasData(
- new
- {
- gameId = 1,
- durationGame = 65,
- loser = "test2",
- nbMaxEchanges = 5,
- scoreLoser = 2,
- scoreWinner = 6,
- winner = "test"
- });
+ b.ToTable("Games", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Message", b =>
@@ -124,25 +104,7 @@ namespace DataBase.Migrations
b.HasIndex("player");
- b.ToTable("Messages");
-
- b.HasData(
- new
- {
- messageId = 1,
- chat = 1,
- message = "Salut mon gars !",
- player = "test",
- timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified)
- },
- new
- {
- messageId = 2,
- chat = 1,
- message = "Comment tu vas ?",
- player = "test2",
- timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified)
- });
+ b.ToTable("Messages", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Player", b =>
@@ -162,23 +124,7 @@ namespace DataBase.Migrations
b.HasKey("playerId");
- b.ToTable("Players");
-
- b.HasData(
- new
- {
- playerId = "test",
- name = "Rami",
- nbBallTouchTotal = 20,
- timePlayed = 120
- },
- new
- {
- playerId = "test2",
- name = "Hugo",
- nbBallTouchTotal = 90,
- timePlayed = 250
- });
+ b.ToTable("Players", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Chat", b =>
diff --git a/code/server/DataBase/Migrations/20230316092529_mymigrations.cs b/code/server/DataBase/Migrations/20230316103854_mymigrations.cs
similarity index 82%
rename from code/server/DataBase/Migrations/20230316092529_mymigrations.cs
rename to code/server/DataBase/Migrations/20230316103854_mymigrations.cs
index 698e944..a06f971 100644
--- a/code/server/DataBase/Migrations/20230316092529_mymigrations.cs
+++ b/code/server/DataBase/Migrations/20230316103854_mymigrations.cs
@@ -3,8 +3,6 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
-#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
-
namespace DataBase.Migrations
{
///
@@ -111,34 +109,6 @@ namespace DataBase.Migrations
onDelete: ReferentialAction.Cascade);
});
- migrationBuilder.InsertData(
- table: "Players",
- columns: new[] { "playerId", "name", "nbBallTouchTotal", "timePlayed" },
- values: new object[,]
- {
- { "test", "Rami", 20, 120 },
- { "test2", "Hugo", 90, 250 }
- });
-
- migrationBuilder.InsertData(
- table: "Chats",
- columns: new[] { "chatId", "player1", "player2" },
- values: new object[] { 1, "test", "test2" });
-
- migrationBuilder.InsertData(
- table: "Games",
- columns: new[] { "gameId", "durationGame", "loser", "nbMaxEchanges", "scoreLoser", "scoreWinner", "winner" },
- values: new object[] { 1, 65, "test2", 5, 2, 6, "test" });
-
- migrationBuilder.InsertData(
- table: "Messages",
- columns: new[] { "messageId", "chat", "message", "player", "timestamp" },
- values: new object[,]
- {
- { 1, 1, "Salut mon gars !", "test", new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified) },
- { 2, 1, "Comment tu vas ?", "test2", new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified) }
- });
-
migrationBuilder.CreateIndex(
name: "IX_Chats_player1",
table: "Chats",
diff --git a/code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs b/code/server/DataBase/Migrations/PongDbContextModelSnapshot.cs
similarity index 71%
rename from code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs
rename to code/server/DataBase/Migrations/PongDbContextModelSnapshot.cs
index 7d94251..fa76d60 100644
--- a/code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs
+++ b/code/server/DataBase/Migrations/PongDbContextModelSnapshot.cs
@@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DataBase.Migrations
{
- [DbContext(typeof(PongDbContextWithStub))]
- partial class PongDbContextWithStubModelSnapshot : ModelSnapshot
+ [DbContext(typeof(PongDbContext))]
+ partial class PongDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
@@ -37,15 +37,7 @@ namespace DataBase.Migrations
b.HasIndex("player2");
- b.ToTable("Chats");
-
- b.HasData(
- new
- {
- chatId = 1,
- player1 = "test",
- player2 = "test2"
- });
+ b.ToTable("Chats", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Game", b =>
@@ -80,19 +72,7 @@ namespace DataBase.Migrations
b.HasIndex("winner");
- b.ToTable("Games");
-
- b.HasData(
- new
- {
- gameId = 1,
- durationGame = 65,
- loser = "test2",
- nbMaxEchanges = 5,
- scoreLoser = 2,
- scoreWinner = 6,
- winner = "test"
- });
+ b.ToTable("Games", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Message", b =>
@@ -121,25 +101,7 @@ namespace DataBase.Migrations
b.HasIndex("player");
- b.ToTable("Messages");
-
- b.HasData(
- new
- {
- messageId = 1,
- chat = 1,
- message = "Salut mon gars !",
- player = "test",
- timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified)
- },
- new
- {
- messageId = 2,
- chat = 1,
- message = "Comment tu vas ?",
- player = "test2",
- timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified)
- });
+ b.ToTable("Messages", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Player", b =>
@@ -159,23 +121,7 @@ namespace DataBase.Migrations
b.HasKey("playerId");
- b.ToTable("Players");
-
- b.HasData(
- new
- {
- playerId = "test",
- name = "Rami",
- nbBallTouchTotal = 20,
- timePlayed = 120
- },
- new
- {
- playerId = "test2",
- name = "Hugo",
- nbBallTouchTotal = 90,
- timePlayed = 250
- });
+ b.ToTable("Players", (string)null);
});
modelBuilder.Entity("DataBase.Entity.Chat", b =>
diff --git a/code/server/DataBase/PongDB.db b/code/server/DataBase/PongDB.db
index 76ba767..5a1539a 100644
Binary files a/code/server/DataBase/PongDB.db and b/code/server/DataBase/PongDB.db differ
diff --git a/code/server/DataBase/PongDB.db-shm b/code/server/DataBase/PongDB.db-shm
deleted file mode 100644
index fe9ac28..0000000
Binary files a/code/server/DataBase/PongDB.db-shm and /dev/null differ
diff --git a/code/server/DataBase/PongDB.db-wal b/code/server/DataBase/PongDB.db-wal
deleted file mode 100644
index e69de29..0000000