🔨 modif tu context database
continuous-integration/drone/push Build is passing Details

pull/7/head
Noan07 2 years ago
parent ec8784922f
commit 00a865780f

@ -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}");
}

@ -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
{
/// <inheritdoc />
@ -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 =>

@ -3,8 +3,6 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace DataBase.Migrations
{
/// <inheritdoc />
@ -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",

@ -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 =>

Binary file not shown.
Loading…
Cancel
Save