Fix MySQL migrations

Fixes #168
This commit is contained in:
Pat Hartl 2025-02-12 20:38:59 -06:00
parent 10e4db0ec6
commit 2012f12379
9 changed files with 19 additions and 29 deletions

View file

@ -9,15 +9,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.2.efcore.9.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LANCommander.Server.Data\LANCommander.Server.Data.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View file

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace LANCommander.Server.Data.MySQL.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20250203083220_InitialMigration")]
[Migration("20250213023250_InitialMigration")]
partial class InitialMigration
{
/// <inheritdoc />
@ -20,7 +20,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("ProductVersion", "9.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
@ -806,8 +806,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<Guid?>("GameId")
.IsRequired()
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<int>("MaxPlayers")
@ -1263,8 +1262,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.Property<int?>("Port")
.HasColumnType("int");
b.Property<Guid?>("ServerId")
.IsRequired()
b.Property<Guid>("ServerId")
.HasColumnType("char(36)");
b.Property<Guid?>("ServerId1")
@ -1524,8 +1522,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UserId")
.IsRequired()
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<string>("Value")
@ -2201,7 +2198,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.HasOne("LANCommander.Server.Data.Models.StorageLocation", "StorageLocation")
.WithMany("Media")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.SetNull)
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Media", "Thumbnail")

View file

@ -1245,7 +1245,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
column: x => x.StorageLocationId,
principalTable: "StorageLocations",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Media_Users_CreatedById",
column: x => x.CreatedById,

View file

@ -17,7 +17,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("ProductVersion", "9.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
@ -803,8 +803,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<Guid?>("GameId")
.IsRequired()
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<int>("MaxPlayers")
@ -1260,8 +1259,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.Property<int?>("Port")
.HasColumnType("int");
b.Property<Guid?>("ServerId")
.IsRequired()
b.Property<Guid>("ServerId")
.HasColumnType("char(36)");
b.Property<Guid?>("ServerId1")
@ -1521,8 +1519,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UserId")
.IsRequired()
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<string>("Value")
@ -2198,7 +2195,7 @@ namespace LANCommander.Server.Data.MySQL.Migrations
b.HasOne("LANCommander.Server.Data.Models.StorageLocation", "StorageLocation")
.WithMany("Media")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.SetNull)
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Media", "Thumbnail")