From 0825bcfe9bfd5af5add32a21b20a16cf6bc976ff Mon Sep 17 00:00:00 2001
From: Noan07 <84435602+Noan07@users.noreply.github.com>
Date: Thu, 16 Mar 2023 10:26:11 +0100
Subject: [PATCH] :hammer: ajout bdd
---
code/server/DataBase/Context/PongDbContext.cs | 2 +-
...> 20230316092529_mymigrations.Designer.cs} | 50 ++++++++++--------
...ions.cs => 20230316092529_mymigrations.cs} | 27 +++++-----
.../PongDbContextWithStubModelSnapshot.cs | 46 ++++++++--------
code/server/DataBase/PongDB.db | Bin 57344 -> 61440 bytes
code/server/DataBase/PongDB.db-shm | Bin 32768 -> 0 bytes
code/server/DataBase/PongDB.db-wal | 0
7 files changed, 66 insertions(+), 59 deletions(-)
rename code/server/DataBase/Migrations/{20230228121953_Migrations.Designer.cs => 20230316092529_mymigrations.Designer.cs} (84%)
rename code/server/DataBase/Migrations/{20230228121953_Migrations.cs => 20230316092529_mymigrations.cs} (87%)
delete mode 100644 code/server/DataBase/PongDB.db-shm
delete mode 100644 code/server/DataBase/PongDB.db-wal
diff --git a/code/server/DataBase/Context/PongDbContext.cs b/code/server/DataBase/Context/PongDbContext.cs
index 5829fd8..7bc4621 100644
--- a/code/server/DataBase/Context/PongDbContext.cs
+++ b/code/server/DataBase/Context/PongDbContext.cs
@@ -19,7 +19,7 @@ namespace DataBase.Context
if (!optionsBuilder.IsConfigured)
{
- optionsBuilder.UseSqlite($"Data Source=C:\\Users\\noanr\\source\\repos\\leap-hit-server\\code\\server\\DataBase\\PongDB.db");
+ optionsBuilder.UseSqlite("Data Source=../DataBase/PongDB.db");
}
}
}
diff --git a/code/server/DataBase/Migrations/20230228121953_Migrations.Designer.cs b/code/server/DataBase/Migrations/20230316092529_mymigrations.Designer.cs
similarity index 84%
rename from code/server/DataBase/Migrations/20230228121953_Migrations.Designer.cs
rename to code/server/DataBase/Migrations/20230316092529_mymigrations.Designer.cs
index a256488..081b26f 100644
--- a/code/server/DataBase/Migrations/20230228121953_Migrations.Designer.cs
+++ b/code/server/DataBase/Migrations/20230316092529_mymigrations.Designer.cs
@@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DataBase.Migrations
{
[DbContext(typeof(PongDbContextWithStub))]
- [Migration("20230228121953_Migrations")]
- partial class Migrations
+ [Migration("20230316092529_mymigrations")]
+ partial class mymigrations
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -26,11 +26,13 @@ namespace DataBase.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
- b.Property("player1")
- .HasColumnType("INTEGER");
+ b.Property("player1")
+ .IsRequired()
+ .HasColumnType("TEXT");
- b.Property("player2")
- .HasColumnType("INTEGER");
+ b.Property("player2")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.HasKey("chatId");
@@ -44,8 +46,8 @@ namespace DataBase.Migrations
new
{
chatId = 1,
- player1 = 1,
- player2 = 2
+ player1 = "test",
+ player2 = "test2"
});
});
@@ -58,8 +60,9 @@ namespace DataBase.Migrations
b.Property("durationGame")
.HasColumnType("INTEGER");
- b.Property("loser")
- .HasColumnType("INTEGER");
+ b.Property("loser")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.Property("nbMaxEchanges")
.HasColumnType("INTEGER");
@@ -70,8 +73,9 @@ namespace DataBase.Migrations
b.Property("scoreWinner")
.HasColumnType("INTEGER");
- b.Property("winner")
- .HasColumnType("INTEGER");
+ b.Property("winner")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.HasKey("gameId");
@@ -86,11 +90,11 @@ namespace DataBase.Migrations
{
gameId = 1,
durationGame = 65,
- loser = 2,
+ loser = "test2",
nbMaxEchanges = 5,
scoreLoser = 2,
scoreWinner = 6,
- winner = 1
+ winner = "test"
});
});
@@ -107,8 +111,9 @@ namespace DataBase.Migrations
.IsRequired()
.HasColumnType("TEXT");
- b.Property("player")
- .HasColumnType("INTEGER");
+ b.Property("player")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.Property("timestamp")
.HasColumnType("TEXT");
@@ -127,7 +132,7 @@ namespace DataBase.Migrations
messageId = 1,
chat = 1,
message = "Salut mon gars !",
- player = 1,
+ player = "test",
timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified)
},
new
@@ -135,16 +140,15 @@ namespace DataBase.Migrations
messageId = 2,
chat = 1,
message = "Comment tu vas ?",
- player = 2,
+ player = "test2",
timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified)
});
});
modelBuilder.Entity("DataBase.Entity.Player", b =>
{
- b.Property("playerId")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property("playerId")
+ .HasColumnType("TEXT");
b.Property("name")
.IsRequired()
@@ -163,14 +167,14 @@ namespace DataBase.Migrations
b.HasData(
new
{
- playerId = 1,
+ playerId = "test",
name = "Rami",
nbBallTouchTotal = 20,
timePlayed = 120
},
new
{
- playerId = 2,
+ playerId = "test2",
name = "Hugo",
nbBallTouchTotal = 90,
timePlayed = 250
diff --git a/code/server/DataBase/Migrations/20230228121953_Migrations.cs b/code/server/DataBase/Migrations/20230316092529_mymigrations.cs
similarity index 87%
rename from code/server/DataBase/Migrations/20230228121953_Migrations.cs
rename to code/server/DataBase/Migrations/20230316092529_mymigrations.cs
index cf2b11d..698e944 100644
--- a/code/server/DataBase/Migrations/20230228121953_Migrations.cs
+++ b/code/server/DataBase/Migrations/20230316092529_mymigrations.cs
@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DataBase.Migrations
{
///
- public partial class Migrations : Migration
+ public partial class mymigrations : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
@@ -17,8 +17,7 @@ namespace DataBase.Migrations
name: "Players",
columns: table => new
{
- playerId = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
+ playerId = table.Column(type: "TEXT", nullable: false),
name = table.Column(type: "TEXT", nullable: false),
nbBallTouchTotal = table.Column(type: "INTEGER", nullable: false),
timePlayed = table.Column(type: "INTEGER", nullable: false)
@@ -34,8 +33,8 @@ namespace DataBase.Migrations
{
chatId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
- player1 = table.Column(type: "INTEGER", nullable: false),
- player2 = table.Column(type: "INTEGER", nullable: false)
+ player1 = table.Column(type: "TEXT", nullable: false),
+ player2 = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
@@ -62,8 +61,8 @@ namespace DataBase.Migrations
.Annotation("Sqlite:Autoincrement", true),
durationGame = table.Column(type: "INTEGER", nullable: false),
nbMaxEchanges = table.Column(type: "INTEGER", nullable: false),
- winner = table.Column(type: "INTEGER", nullable: false),
- loser = table.Column(type: "INTEGER", nullable: false),
+ winner = table.Column(type: "TEXT", nullable: false),
+ loser = table.Column(type: "TEXT", nullable: false),
scoreWinner = table.Column(type: "INTEGER", nullable: false),
scoreLoser = table.Column(type: "INTEGER", nullable: false)
},
@@ -92,7 +91,7 @@ namespace DataBase.Migrations
.Annotation("Sqlite:Autoincrement", true),
message = table.Column(type: "TEXT", nullable: false),
timestamp = table.Column(type: "TEXT", nullable: false),
- player = table.Column(type: "INTEGER", nullable: false),
+ player = table.Column(type: "TEXT", nullable: false),
chat = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
@@ -117,27 +116,27 @@ namespace DataBase.Migrations
columns: new[] { "playerId", "name", "nbBallTouchTotal", "timePlayed" },
values: new object[,]
{
- { 1, "Rami", 20, 120 },
- { 2, "Hugo", 90, 250 }
+ { "test", "Rami", 20, 120 },
+ { "test2", "Hugo", 90, 250 }
});
migrationBuilder.InsertData(
table: "Chats",
columns: new[] { "chatId", "player1", "player2" },
- values: new object[] { 1, 1, 2 });
+ values: new object[] { 1, "test", "test2" });
migrationBuilder.InsertData(
table: "Games",
columns: new[] { "gameId", "durationGame", "loser", "nbMaxEchanges", "scoreLoser", "scoreWinner", "winner" },
- values: new object[] { 1, 65, 2, 5, 2, 6, 1 });
+ 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 !", 1, new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified) },
- { 2, 1, "Comment tu vas ?", 2, new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified) }
+ { 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(
diff --git a/code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs b/code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs
index e144450..7d94251 100644
--- a/code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs
+++ b/code/server/DataBase/Migrations/PongDbContextWithStubModelSnapshot.cs
@@ -23,11 +23,13 @@ namespace DataBase.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
- b.Property("player1")
- .HasColumnType("INTEGER");
+ b.Property("player1")
+ .IsRequired()
+ .HasColumnType("TEXT");
- b.Property("player2")
- .HasColumnType("INTEGER");
+ b.Property("player2")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.HasKey("chatId");
@@ -41,8 +43,8 @@ namespace DataBase.Migrations
new
{
chatId = 1,
- player1 = 1,
- player2 = 2
+ player1 = "test",
+ player2 = "test2"
});
});
@@ -55,8 +57,9 @@ namespace DataBase.Migrations
b.Property("durationGame")
.HasColumnType("INTEGER");
- b.Property("loser")
- .HasColumnType("INTEGER");
+ b.Property("loser")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.Property("nbMaxEchanges")
.HasColumnType("INTEGER");
@@ -67,8 +70,9 @@ namespace DataBase.Migrations
b.Property("scoreWinner")
.HasColumnType("INTEGER");
- b.Property("winner")
- .HasColumnType("INTEGER");
+ b.Property("winner")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.HasKey("gameId");
@@ -83,11 +87,11 @@ namespace DataBase.Migrations
{
gameId = 1,
durationGame = 65,
- loser = 2,
+ loser = "test2",
nbMaxEchanges = 5,
scoreLoser = 2,
scoreWinner = 6,
- winner = 1
+ winner = "test"
});
});
@@ -104,8 +108,9 @@ namespace DataBase.Migrations
.IsRequired()
.HasColumnType("TEXT");
- b.Property("player")
- .HasColumnType("INTEGER");
+ b.Property("player")
+ .IsRequired()
+ .HasColumnType("TEXT");
b.Property("timestamp")
.HasColumnType("TEXT");
@@ -124,7 +129,7 @@ namespace DataBase.Migrations
messageId = 1,
chat = 1,
message = "Salut mon gars !",
- player = 1,
+ player = "test",
timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified)
},
new
@@ -132,16 +137,15 @@ namespace DataBase.Migrations
messageId = 2,
chat = 1,
message = "Comment tu vas ?",
- player = 2,
+ player = "test2",
timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified)
});
});
modelBuilder.Entity("DataBase.Entity.Player", b =>
{
- b.Property("playerId")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property("playerId")
+ .HasColumnType("TEXT");
b.Property("name")
.IsRequired()
@@ -160,14 +164,14 @@ namespace DataBase.Migrations
b.HasData(
new
{
- playerId = 1,
+ playerId = "test",
name = "Rami",
nbBallTouchTotal = 20,
timePlayed = 120
},
new
{
- playerId = 2,
+ playerId = "test2",
name = "Hugo",
nbBallTouchTotal = 90,
timePlayed = 250
diff --git a/code/server/DataBase/PongDB.db b/code/server/DataBase/PongDB.db
index 07e0a8ce797734c0ead6ef21277e81e79d0602be..76ba767102f09f04d92ba2c694e00e8100591a41 100644
GIT binary patch
delta 846
zcmah`&r1|h9Dm=Loi{W4W4>-Uy>we$SP{Zp_eW+DMPiYcNWw#OStpvdrCpbt71oo6
zV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