This commit is contained in:
glax 2025-05-26 01:44:36 +02:00
parent 1a08f932af
commit 4405c0349e
4 changed files with 426 additions and 0 deletions

View File

@ -0,0 +1,148 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SQLiteEF;
#nullable disable
namespace API.Migrations
{
[DbContext(typeof(Context))]
[Migration("20250525221352_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.5");
modelBuilder.Entity("GamePlayer", b =>
{
b.Property<ulong>("GamesAppId")
.HasColumnType("INTEGER");
b.Property<ulong>("PlayedBySteamId")
.HasColumnType("INTEGER");
b.HasKey("GamesAppId", "PlayedBySteamId");
b.HasIndex("PlayedBySteamId");
b.ToTable("GamePlayer");
});
modelBuilder.Entity("SQLiteEF.Game", b =>
{
b.Property<ulong>("AppId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("AppId");
b.ToTable("Games");
});
modelBuilder.Entity("SQLiteEF.Player", b =>
{
b.Property<ulong>("SteamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AvatarUrl")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ProfileUrl")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("TEXT");
b.HasKey("SteamId");
b.ToTable("Players");
});
modelBuilder.Entity("SQLiteEF.TrackedTime", b =>
{
b.Property<DateTime>("TimeStamp")
.HasColumnType("TEXT");
b.Property<ulong>("GameAppId")
.HasColumnType("INTEGER");
b.Property<ulong>("PlayerSteamId")
.HasColumnType("INTEGER");
b.Property<ulong>("TimePlayed")
.HasColumnType("INTEGER");
b.HasKey("TimeStamp");
b.HasIndex("GameAppId");
b.HasIndex("PlayerSteamId");
b.ToTable("TrackedTime");
});
modelBuilder.Entity("GamePlayer", b =>
{
b.HasOne("SQLiteEF.Game", null)
.WithMany()
.HasForeignKey("GamesAppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SQLiteEF.Player", null)
.WithMany()
.HasForeignKey("PlayedBySteamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SQLiteEF.TrackedTime", b =>
{
b.HasOne("SQLiteEF.Game", "Game")
.WithMany("TrackedTimes")
.HasForeignKey("GameAppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SQLiteEF.Player", "Player")
.WithMany("TrackedTimes")
.HasForeignKey("PlayerSteamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Game");
b.Navigation("Player");
});
modelBuilder.Entity("SQLiteEF.Game", b =>
{
b.Navigation("TrackedTimes");
});
modelBuilder.Entity("SQLiteEF.Player", b =>
{
b.Navigation("TrackedTimes");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,125 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace API.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Games",
columns: table => new
{
AppId = table.Column<ulong>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Games", x => x.AppId);
});
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
SteamId = table.Column<ulong>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
ProfileUrl = table.Column<string>(type: "TEXT", nullable: false),
AvatarUrl = table.Column<string>(type: "TEXT", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.SteamId);
});
migrationBuilder.CreateTable(
name: "GamePlayer",
columns: table => new
{
GamesAppId = table.Column<ulong>(type: "INTEGER", nullable: false),
PlayedBySteamId = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GamePlayer", x => new { x.GamesAppId, x.PlayedBySteamId });
table.ForeignKey(
name: "FK_GamePlayer_Games_GamesAppId",
column: x => x.GamesAppId,
principalTable: "Games",
principalColumn: "AppId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GamePlayer_Players_PlayedBySteamId",
column: x => x.PlayedBySteamId,
principalTable: "Players",
principalColumn: "SteamId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TrackedTime",
columns: table => new
{
TimeStamp = table.Column<DateTime>(type: "TEXT", nullable: false),
GameAppId = table.Column<ulong>(type: "INTEGER", nullable: false),
PlayerSteamId = table.Column<ulong>(type: "INTEGER", nullable: false),
TimePlayed = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TrackedTime", x => x.TimeStamp);
table.ForeignKey(
name: "FK_TrackedTime_Games_GameAppId",
column: x => x.GameAppId,
principalTable: "Games",
principalColumn: "AppId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TrackedTime_Players_PlayerSteamId",
column: x => x.PlayerSteamId,
principalTable: "Players",
principalColumn: "SteamId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_GamePlayer_PlayedBySteamId",
table: "GamePlayer",
column: "PlayedBySteamId");
migrationBuilder.CreateIndex(
name: "IX_TrackedTime_GameAppId",
table: "TrackedTime",
column: "GameAppId");
migrationBuilder.CreateIndex(
name: "IX_TrackedTime_PlayerSteamId",
table: "TrackedTime",
column: "PlayerSteamId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GamePlayer");
migrationBuilder.DropTable(
name: "TrackedTime");
migrationBuilder.DropTable(
name: "Games");
migrationBuilder.DropTable(
name: "Players");
}
}
}

View File

@ -0,0 +1,145 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SQLiteEF;
#nullable disable
namespace API.Migrations
{
[DbContext(typeof(Context))]
partial class ContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.5");
modelBuilder.Entity("GamePlayer", b =>
{
b.Property<ulong>("GamesAppId")
.HasColumnType("INTEGER");
b.Property<ulong>("PlayedBySteamId")
.HasColumnType("INTEGER");
b.HasKey("GamesAppId", "PlayedBySteamId");
b.HasIndex("PlayedBySteamId");
b.ToTable("GamePlayer");
});
modelBuilder.Entity("SQLiteEF.Game", b =>
{
b.Property<ulong>("AppId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("AppId");
b.ToTable("Games");
});
modelBuilder.Entity("SQLiteEF.Player", b =>
{
b.Property<ulong>("SteamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AvatarUrl")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ProfileUrl")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("TEXT");
b.HasKey("SteamId");
b.ToTable("Players");
});
modelBuilder.Entity("SQLiteEF.TrackedTime", b =>
{
b.Property<DateTime>("TimeStamp")
.HasColumnType("TEXT");
b.Property<ulong>("GameAppId")
.HasColumnType("INTEGER");
b.Property<ulong>("PlayerSteamId")
.HasColumnType("INTEGER");
b.Property<ulong>("TimePlayed")
.HasColumnType("INTEGER");
b.HasKey("TimeStamp");
b.HasIndex("GameAppId");
b.HasIndex("PlayerSteamId");
b.ToTable("TrackedTime");
});
modelBuilder.Entity("GamePlayer", b =>
{
b.HasOne("SQLiteEF.Game", null)
.WithMany()
.HasForeignKey("GamesAppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SQLiteEF.Player", null)
.WithMany()
.HasForeignKey("PlayedBySteamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SQLiteEF.TrackedTime", b =>
{
b.HasOne("SQLiteEF.Game", "Game")
.WithMany("TrackedTimes")
.HasForeignKey("GameAppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SQLiteEF.Player", "Player")
.WithMany("TrackedTimes")
.HasForeignKey("PlayerSteamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Game");
b.Navigation("Player");
});
modelBuilder.Entity("SQLiteEF.Game", b =>
{
b.Navigation("TrackedTimes");
});
modelBuilder.Entity("SQLiteEF.Player", b =>
{
b.Navigation("TrackedTimes");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallSiteValidator_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F223f3993d7b717137d1eac7a1da6b5a458d1d124b0f8a62a3450f9bd6c89af_003FCallSiteValidator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADbConnectionStringBuilder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F90c837a1317d49ef94f93ed3285e27ca2bdc00_003F5a_003F4192172b_003FDbConnectionStringBuilder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADbContextServices_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fc28655223245c8d433d4d4234c31c4b8a4fd871bd6a0e2268c726eb4db0d_003FDbContextServices_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEntityFinder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fd8142acd624a4579e70bd7df6edcf5f73fc8c86908b583b38f17b390476a1f_003FEntityFinder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMigrationCommandExecutor_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fb43021565ba7f13262dd95827ae378ea6015db2c146979398f92c7356d98488_003FMigrationCommandExecutor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARelationalConnection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F696ea149e41ddc60bdd9238370d01ba5f417a4a91ce8ac42c17d4eee0afa038_003FRelationalConnection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASingleQueryingEnumerable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F413341ec7da6e42cb630e52ba9208edacb2e7267da1d9296f51628fcd35e81d9_003FSingleQueryingEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>