🔨 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)
{
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
{
[DbContext(typeof(PongDbContextWithStub))]
[Migration("20230228121953_Migrations")]
partial class Migrations
[Migration("20230316092529_mymigrations")]
partial class mymigrations
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -26,11 +26,13 @@ namespace DataBase.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("player1")
.HasColumnType("INTEGER");
b.Property<string>("player1")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("player2")
.HasColumnType("INTEGER");
b.Property<string>("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<int>("durationGame")
.HasColumnType("INTEGER");
b.Property<int>("loser")
.HasColumnType("INTEGER");
b.Property<string>("loser")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("nbMaxEchanges")
.HasColumnType("INTEGER");
@ -70,8 +73,9 @@ namespace DataBase.Migrations
b.Property<int>("scoreWinner")
.HasColumnType("INTEGER");
b.Property<int>("winner")
.HasColumnType("INTEGER");
b.Property<string>("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<int>("player")
.HasColumnType("INTEGER");
b.Property<string>("player")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("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<int>("playerId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("playerId")
.HasColumnType("TEXT");
b.Property<string>("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

@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DataBase.Migrations
{
/// <inheritdoc />
public partial class Migrations : Migration
public partial class mymigrations : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -17,8 +17,7 @@ namespace DataBase.Migrations
name: "Players",
columns: table => new
{
playerId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
playerId = table.Column<string>(type: "TEXT", nullable: false),
name = table.Column<string>(type: "TEXT", nullable: false),
nbBallTouchTotal = 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)
.Annotation("Sqlite:Autoincrement", true),
player1 = table.Column<int>(type: "INTEGER", nullable: false),
player2 = table.Column<int>(type: "INTEGER", nullable: false)
player1 = table.Column<string>(type: "TEXT", nullable: false),
player2 = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
@ -62,8 +61,8 @@ namespace DataBase.Migrations
.Annotation("Sqlite:Autoincrement", true),
durationGame = table.Column<int>(type: "INTEGER", nullable: false),
nbMaxEchanges = table.Column<int>(type: "INTEGER", nullable: false),
winner = table.Column<int>(type: "INTEGER", nullable: false),
loser = table.Column<int>(type: "INTEGER", nullable: false),
winner = table.Column<string>(type: "TEXT", nullable: false),
loser = table.Column<string>(type: "TEXT", nullable: false),
scoreWinner = 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),
message = table.Column<string>(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)
},
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(

@ -23,11 +23,13 @@ namespace DataBase.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("player1")
.HasColumnType("INTEGER");
b.Property<string>("player1")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("player2")
.HasColumnType("INTEGER");
b.Property<string>("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<int>("durationGame")
.HasColumnType("INTEGER");
b.Property<int>("loser")
.HasColumnType("INTEGER");
b.Property<string>("loser")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("nbMaxEchanges")
.HasColumnType("INTEGER");
@ -67,8 +70,9 @@ namespace DataBase.Migrations
b.Property<int>("scoreWinner")
.HasColumnType("INTEGER");
b.Property<int>("winner")
.HasColumnType("INTEGER");
b.Property<string>("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<int>("player")
.HasColumnType("INTEGER");
b.Property<string>("player")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("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<int>("playerId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("playerId")
.HasColumnType("TEXT");
b.Property<string>("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

Binary file not shown.
Loading…
Cancel
Save