🔨 ajout bdd
continuous-integration/drone/push Build is passing Details

pull/7/head
Noan07 2 years ago
parent 1d80ebd11f
commit 0825bcfe9b

@ -19,7 +19,7 @@ namespace DataBase.Context
if (!optionsBuilder.IsConfigured) 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");
} }
} }
} }

@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DataBase.Migrations namespace DataBase.Migrations
{ {
[DbContext(typeof(PongDbContextWithStub))] [DbContext(typeof(PongDbContextWithStub))]
[Migration("20230228121953_Migrations")] [Migration("20230316092529_mymigrations")]
partial class Migrations partial class mymigrations
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -26,11 +26,13 @@ namespace DataBase.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("player1") b.Property<string>("player1")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.Property<int>("player2") b.Property<string>("player2")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("chatId"); b.HasKey("chatId");
@ -44,8 +46,8 @@ namespace DataBase.Migrations
new new
{ {
chatId = 1, chatId = 1,
player1 = 1, player1 = "test",
player2 = 2 player2 = "test2"
}); });
}); });
@ -58,8 +60,9 @@ namespace DataBase.Migrations
b.Property<int>("durationGame") b.Property<int>("durationGame")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("loser") b.Property<string>("loser")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.Property<int>("nbMaxEchanges") b.Property<int>("nbMaxEchanges")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -70,8 +73,9 @@ namespace DataBase.Migrations
b.Property<int>("scoreWinner") b.Property<int>("scoreWinner")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("winner") b.Property<string>("winner")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("gameId"); b.HasKey("gameId");
@ -86,11 +90,11 @@ namespace DataBase.Migrations
{ {
gameId = 1, gameId = 1,
durationGame = 65, durationGame = 65,
loser = 2, loser = "test2",
nbMaxEchanges = 5, nbMaxEchanges = 5,
scoreLoser = 2, scoreLoser = 2,
scoreWinner = 6, scoreWinner = 6,
winner = 1 winner = "test"
}); });
}); });
@ -107,8 +111,9 @@ namespace DataBase.Migrations
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("player") b.Property<string>("player")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("timestamp") b.Property<DateTime>("timestamp")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
@ -127,7 +132,7 @@ namespace DataBase.Migrations
messageId = 1, messageId = 1,
chat = 1, chat = 1,
message = "Salut mon gars !", message = "Salut mon gars !",
player = 1, player = "test",
timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified) timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified)
}, },
new new
@ -135,16 +140,15 @@ namespace DataBase.Migrations
messageId = 2, messageId = 2,
chat = 1, chat = 1,
message = "Comment tu vas ?", message = "Comment tu vas ?",
player = 2, player = "test2",
timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified) timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified)
}); });
}); });
modelBuilder.Entity("DataBase.Entity.Player", b => modelBuilder.Entity("DataBase.Entity.Player", b =>
{ {
b.Property<int>("playerId") b.Property<string>("playerId")
.ValueGeneratedOnAdd() .HasColumnType("TEXT");
.HasColumnType("INTEGER");
b.Property<string>("name") b.Property<string>("name")
.IsRequired() .IsRequired()
@ -163,14 +167,14 @@ namespace DataBase.Migrations
b.HasData( b.HasData(
new new
{ {
playerId = 1, playerId = "test",
name = "Rami", name = "Rami",
nbBallTouchTotal = 20, nbBallTouchTotal = 20,
timePlayed = 120 timePlayed = 120
}, },
new new
{ {
playerId = 2, playerId = "test2",
name = "Hugo", name = "Hugo",
nbBallTouchTotal = 90, nbBallTouchTotal = 90,
timePlayed = 250 timePlayed = 250

@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DataBase.Migrations namespace DataBase.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class Migrations : Migration public partial class mymigrations : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@ -17,8 +17,7 @@ namespace DataBase.Migrations
name: "Players", name: "Players",
columns: table => new columns: table => new
{ {
playerId = table.Column<int>(type: "INTEGER", nullable: false) playerId = table.Column<string>(type: "TEXT", nullable: false),
.Annotation("Sqlite:Autoincrement", true),
name = table.Column<string>(type: "TEXT", nullable: false), name = table.Column<string>(type: "TEXT", nullable: false),
nbBallTouchTotal = table.Column<int>(type: "INTEGER", nullable: false), nbBallTouchTotal = table.Column<int>(type: "INTEGER", nullable: false),
timePlayed = table.Column<int>(type: "INTEGER", nullable: false) timePlayed = table.Column<int>(type: "INTEGER", nullable: false)
@ -34,8 +33,8 @@ namespace DataBase.Migrations
{ {
chatId = table.Column<int>(type: "INTEGER", nullable: false) chatId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
player1 = table.Column<int>(type: "INTEGER", nullable: false), player1 = table.Column<string>(type: "TEXT", nullable: false),
player2 = table.Column<int>(type: "INTEGER", nullable: false) player2 = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -62,8 +61,8 @@ namespace DataBase.Migrations
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
durationGame = table.Column<int>(type: "INTEGER", nullable: false), durationGame = table.Column<int>(type: "INTEGER", nullable: false),
nbMaxEchanges = table.Column<int>(type: "INTEGER", nullable: false), nbMaxEchanges = table.Column<int>(type: "INTEGER", nullable: false),
winner = table.Column<int>(type: "INTEGER", nullable: false), winner = table.Column<string>(type: "TEXT", nullable: false),
loser = table.Column<int>(type: "INTEGER", nullable: false), loser = table.Column<string>(type: "TEXT", nullable: false),
scoreWinner = table.Column<int>(type: "INTEGER", nullable: false), scoreWinner = table.Column<int>(type: "INTEGER", nullable: false),
scoreLoser = table.Column<int>(type: "INTEGER", nullable: false) scoreLoser = table.Column<int>(type: "INTEGER", nullable: false)
}, },
@ -92,7 +91,7 @@ namespace DataBase.Migrations
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
message = table.Column<string>(type: "TEXT", nullable: false), message = table.Column<string>(type: "TEXT", nullable: false),
timestamp = table.Column<DateTime>(type: "TEXT", nullable: false), timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
player = table.Column<int>(type: "INTEGER", nullable: false), player = table.Column<string>(type: "TEXT", nullable: false),
chat = table.Column<int>(type: "INTEGER", nullable: false) chat = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
@ -117,27 +116,27 @@ namespace DataBase.Migrations
columns: new[] { "playerId", "name", "nbBallTouchTotal", "timePlayed" }, columns: new[] { "playerId", "name", "nbBallTouchTotal", "timePlayed" },
values: new object[,] values: new object[,]
{ {
{ 1, "Rami", 20, 120 }, { "test", "Rami", 20, 120 },
{ 2, "Hugo", 90, 250 } { "test2", "Hugo", 90, 250 }
}); });
migrationBuilder.InsertData( migrationBuilder.InsertData(
table: "Chats", table: "Chats",
columns: new[] { "chatId", "player1", "player2" }, columns: new[] { "chatId", "player1", "player2" },
values: new object[] { 1, 1, 2 }); values: new object[] { 1, "test", "test2" });
migrationBuilder.InsertData( migrationBuilder.InsertData(
table: "Games", table: "Games",
columns: new[] { "gameId", "durationGame", "loser", "nbMaxEchanges", "scoreLoser", "scoreWinner", "winner" }, 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( migrationBuilder.InsertData(
table: "Messages", table: "Messages",
columns: new[] { "messageId", "chat", "message", "player", "timestamp" }, columns: new[] { "messageId", "chat", "message", "player", "timestamp" },
values: new object[,] values: new object[,]
{ {
{ 1, 1, "Salut mon gars !", 1, new DateTime(2023, 2, 16, 17, 5, 12, 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 ?", 2, new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified) } { 2, 1, "Comment tu vas ?", "test2", new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified) }
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(

@ -23,11 +23,13 @@ namespace DataBase.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("player1") b.Property<string>("player1")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.Property<int>("player2") b.Property<string>("player2")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("chatId"); b.HasKey("chatId");
@ -41,8 +43,8 @@ namespace DataBase.Migrations
new new
{ {
chatId = 1, chatId = 1,
player1 = 1, player1 = "test",
player2 = 2 player2 = "test2"
}); });
}); });
@ -55,8 +57,9 @@ namespace DataBase.Migrations
b.Property<int>("durationGame") b.Property<int>("durationGame")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("loser") b.Property<string>("loser")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.Property<int>("nbMaxEchanges") b.Property<int>("nbMaxEchanges")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -67,8 +70,9 @@ namespace DataBase.Migrations
b.Property<int>("scoreWinner") b.Property<int>("scoreWinner")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("winner") b.Property<string>("winner")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("gameId"); b.HasKey("gameId");
@ -83,11 +87,11 @@ namespace DataBase.Migrations
{ {
gameId = 1, gameId = 1,
durationGame = 65, durationGame = 65,
loser = 2, loser = "test2",
nbMaxEchanges = 5, nbMaxEchanges = 5,
scoreLoser = 2, scoreLoser = 2,
scoreWinner = 6, scoreWinner = 6,
winner = 1 winner = "test"
}); });
}); });
@ -104,8 +108,9 @@ namespace DataBase.Migrations
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("player") b.Property<string>("player")
.HasColumnType("INTEGER"); .IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("timestamp") b.Property<DateTime>("timestamp")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
@ -124,7 +129,7 @@ namespace DataBase.Migrations
messageId = 1, messageId = 1,
chat = 1, chat = 1,
message = "Salut mon gars !", message = "Salut mon gars !",
player = 1, player = "test",
timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified) timestamp = new DateTime(2023, 2, 16, 17, 5, 12, 0, DateTimeKind.Unspecified)
}, },
new new
@ -132,16 +137,15 @@ namespace DataBase.Migrations
messageId = 2, messageId = 2,
chat = 1, chat = 1,
message = "Comment tu vas ?", message = "Comment tu vas ?",
player = 2, player = "test2",
timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified) timestamp = new DateTime(2023, 2, 16, 17, 12, 35, 0, DateTimeKind.Unspecified)
}); });
}); });
modelBuilder.Entity("DataBase.Entity.Player", b => modelBuilder.Entity("DataBase.Entity.Player", b =>
{ {
b.Property<int>("playerId") b.Property<string>("playerId")
.ValueGeneratedOnAdd() .HasColumnType("TEXT");
.HasColumnType("INTEGER");
b.Property<string>("name") b.Property<string>("name")
.IsRequired() .IsRequired()
@ -160,14 +164,14 @@ namespace DataBase.Migrations
b.HasData( b.HasData(
new new
{ {
playerId = 1, playerId = "test",
name = "Rami", name = "Rami",
nbBallTouchTotal = 20, nbBallTouchTotal = 20,
timePlayed = 120 timePlayed = 120
}, },
new new
{ {
playerId = 2, playerId = "test2",
name = "Hugo", name = "Hugo",
nbBallTouchTotal = 90, nbBallTouchTotal = 90,
timePlayed = 250 timePlayed = 250

Binary file not shown.
Loading…
Cancel
Save