From f630dfac2c2ac2467a92ccac110352ba4ee1d073 Mon Sep 17 00:00:00 2001 From: Kevin Matsubara Date: Sun, 6 Apr 2025 21:07:11 +0200 Subject: [PATCH] Add migration for seeded leagues. --- .../20250406190614_SeededLeagues.Designer.cs | 312 ++++++++++++++++++ .../20250406190614_SeededLeagues.cs | 52 +++ ...eadBallZoneLeagueDbContextModelSnapshot.cs | 30 ++ 3 files changed, 394 insertions(+) create mode 100644 EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.Designer.cs create mode 100644 EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.cs diff --git a/EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.Designer.cs b/EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.Designer.cs new file mode 100644 index 0000000..d1f3b9e --- /dev/null +++ b/EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.Designer.cs @@ -0,0 +1,312 @@ +// +using System; +using EntityFrameworkCore.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EntityFrameworkCore.Data.Migrations +{ + [DbContext(typeof(DeadBallZoneLeagueDbContext))] + [Migration("20250406190614_SeededLeagues")] + partial class SeededLeagues + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.3"); + + modelBuilder.Entity("EntityFrameworkCore.Domain.Coach", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("ModifiedBy") + .HasColumnType("TEXT"); + + b.Property("ModifiedDate") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Coaches"); + }); + + modelBuilder.Entity("EntityFrameworkCore.Domain.League", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("ModifiedBy") + .HasColumnType("TEXT"); + + b.Property("ModifiedDate") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Leagues"); + + b.HasData( + new + { + Id = 1, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Local League" + }, + new + { + Id = 2, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "National League" + }, + new + { + Id = 3, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Geosphere" + }, + new + { + Id = 4, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Cyber war" + }); + }); + + modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AwayTeamId") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("HomeTeamId") + .HasColumnType("INTEGER"); + + b.Property("ModifiedBy") + .HasColumnType("TEXT"); + + b.Property("ModifiedDate") + .HasColumnType("TEXT"); + + b.Property("TicketPrice") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Matches"); + }); + + modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CoachId") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("LeagueId") + .HasColumnType("INTEGER"); + + b.Property("ModifiedBy") + .HasColumnType("TEXT"); + + b.Property("ModifiedDate") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + Id = 1, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Neo Delhi" + }, + new + { + Id = 2, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Voodoo" + }, + new + { + Id = 3, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Penal X" + }, + new + { + Id = 4, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Neo Tokyo" + }, + new + { + Id = 5, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Neo Barcelona" + }, + new + { + Id = 6, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Neo Manchester" + }, + new + { + Id = 7, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Neo Bangkok" + }, + new + { + Id = 8, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Neo Amsterdam" + }, + new + { + Id = 9, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Killaklowns" + }, + new + { + Id = 10, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Sol" + }, + new + { + Id = 11, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "DEC" + }, + new + { + Id = 12, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Leopards" + }, + new + { + Id = 13, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Harlequins" + }, + new + { + Id = 14, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Gladiators" + }, + new + { + Id = 15, + CoachId = 0, + CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), + LeagueId = 0, + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Fiz-O" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.cs b/EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.cs new file mode 100644 index 0000000..f7179b5 --- /dev/null +++ b/EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace EntityFrameworkCore.Data.Migrations +{ + /// + public partial class SeededLeagues : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Leagues", + columns: new[] { "Id", "CreatedBy", "CreatedDate", "ModifiedBy", "ModifiedDate", "Name" }, + values: new object[,] + { + { 1, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Local League" }, + { 2, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "National League" }, + { 3, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Geosphere" }, + { 4, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cyber war" } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Leagues", + keyColumn: "Id", + keyValue: 1); + + migrationBuilder.DeleteData( + table: "Leagues", + keyColumn: "Id", + keyValue: 2); + + migrationBuilder.DeleteData( + table: "Leagues", + keyColumn: "Id", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "Leagues", + keyColumn: "Id", + keyValue: 4); + } + } +} diff --git a/EntityFrameworkCore.Data/Migrations/DeadBallZoneLeagueDbContextModelSnapshot.cs b/EntityFrameworkCore.Data/Migrations/DeadBallZoneLeagueDbContextModelSnapshot.cs index b08cdd5..ae5bd4f 100644 --- a/EntityFrameworkCore.Data/Migrations/DeadBallZoneLeagueDbContextModelSnapshot.cs +++ b/EntityFrameworkCore.Data/Migrations/DeadBallZoneLeagueDbContextModelSnapshot.cs @@ -68,6 +68,36 @@ namespace EntityFrameworkCore.Data.Migrations b.HasKey("Id"); b.ToTable("Leagues"); + + b.HasData( + new + { + Id = 1, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Local League" + }, + new + { + Id = 2, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "National League" + }, + new + { + Id = 3, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Geosphere" + }, + new + { + Id = 4, + CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), + ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Name = "Cyber war" + }); }); modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b =>