Sube capa Infrastructure, Solution y archivos de configuracion del Backend

This commit is contained in:
FrancoRu
2026-09-18 13:36:47 -03:00
parent 2eb4eeef03
commit 1ef9a0bd03
205 changed files with 77651 additions and 0 deletions
@@ -0,0 +1,625 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250316201442_InitialMigration")]
partial class InitialMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPostEntity.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.DivisionEntity.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.MatchEntity.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("GameNumber")
.HasColumnType("integer");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<int?>("MatchWeek")
.HasColumnType("integer");
b.Property<string>("RoundName")
.HasColumnType("text");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerEntity.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Category")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Club")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<bool>("IsFederated")
.HasColumnType("boolean");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctionEntity.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatisticEntity.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.StaffEntity.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.TeamEntity.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.TournamentEntity.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.UserEntity.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.VenueEntity.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.DivisionEntity.Division", b =>
{
b.HasOne("Entities.Models.TournamentEntity.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.MatchEntity.Match", b =>
{
b.HasOne("Entities.Models.DivisionEntity.Division", "Division")
.WithMany("Matches")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.TeamEntity.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.VenueEntity.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.TeamEntity.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.TeamEntity.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("Division");
b.Navigation("HomeTeam");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerEntity.Player", b =>
{
b.HasOne("Entities.Models.TeamEntity.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.PlayerSanctionEntity.PlayerSanction", b =>
{
b.HasOne("Entities.Models.PlayerEntity.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatisticEntity.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.MatchEntity.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.PlayerEntity.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.StaffEntity.Staff", b =>
{
b.HasOne("Entities.Models.TeamEntity.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.TeamEntity.Team", b =>
{
b.HasOne("Entities.Models.DivisionEntity.Division", "Division")
.WithMany("Teams")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.DivisionEntity.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.MatchEntity.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.TeamEntity.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.TournamentEntity.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,434 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class InitialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "Club12");
migrationBuilder.CreateTable(
name: "BlogPosts",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Author = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
Views = table.Column<int>(type: "integer", nullable: false),
PhotoUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
MarkdownText = table.Column<string>(type: "text", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BlogPosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Tournaments",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Tournaments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Username = table.Column<string>(type: "character varying(25)", maxLength: 25, nullable: false),
Password = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
Role = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
RefreshToken = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
RefreshTokenExpiryTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Venues",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Address = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
PhotoUrl = table.Column<string>(type: "text", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Venues", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Divisions",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
IsFinished = table.Column<bool>(type: "boolean", nullable: false),
TournamentId = table.Column<Guid>(type: "uuid", nullable: false),
PlayoffsGenerated = table.Column<bool>(type: "boolean", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Divisions", x => x.Id);
table.ForeignKey(
name: "FK_Divisions_Tournaments_TournamentId",
column: x => x.TournamentId,
principalSchema: "Club12",
principalTable: "Tournaments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Teams",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
ThreeLetterCode = table.Column<string>(type: "text", nullable: false),
LogoUrl = table.Column<string>(type: "text", nullable: false),
ShirtColor = table.Column<string>(type: "text", nullable: false),
DivisionId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Teams", x => x.Id);
table.ForeignKey(
name: "FK_Teams_Divisions_DivisionId",
column: x => x.DivisionId,
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Matches",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
MatchDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Type = table.Column<string>(type: "text", nullable: false),
MatchWeek = table.Column<int>(type: "integer", nullable: true),
RoundName = table.Column<string>(type: "text", nullable: true),
GameNumber = table.Column<int>(type: "integer", nullable: true),
HomeTeamId = table.Column<Guid>(type: "uuid", nullable: false),
VisitorTeamId = table.Column<Guid>(type: "uuid", nullable: false),
HomeScore = table.Column<int>(type: "integer", nullable: true),
VisitorScore = table.Column<int>(type: "integer", nullable: true),
IsFinished = table.Column<bool>(type: "boolean", nullable: false),
WinningTeamId = table.Column<Guid>(type: "uuid", nullable: true),
DivisionId = table.Column<Guid>(type: "uuid", nullable: false),
VenueId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Matches", x => x.Id);
table.ForeignKey(
name: "FK_Matches_Divisions_DivisionId",
column: x => x.DivisionId,
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Matches_Teams_HomeTeamId",
column: x => x.HomeTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Matches_Teams_VisitorTeamId",
column: x => x.VisitorTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Matches_Teams_WinningTeamId",
column: x => x.WinningTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Matches_Venues_VenueId",
column: x => x.VenueId,
principalSchema: "Club12",
principalTable: "Venues",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Players",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Names = table.Column<string>(type: "character varying(70)", maxLength: 70, nullable: false),
LastName = table.Column<string>(type: "character varying(70)", maxLength: 70, nullable: false),
DocumentNumber = table.Column<string>(type: "character varying(15)", maxLength: 15, nullable: false),
IsSanctioned = table.Column<bool>(type: "boolean", nullable: false),
IsFederated = table.Column<bool>(type: "boolean", nullable: false),
PhoneNumber = table.Column<string>(type: "text", nullable: true),
Club = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
Category = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
BirthDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
SocialSecurity = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.Id);
table.ForeignKey(
name: "FK_Players_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Staffs",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Names = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
LastName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
PhoneNumber = table.Column<string>(type: "character varying(15)", maxLength: 15, nullable: false),
Type = table.Column<string>(type: "text", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Staffs", x => x.Id);
table.ForeignKey(
name: "FK_Staffs_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PlayerSanctions",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Duration = table.Column<int>(type: "integer", nullable: false),
IssuedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Description = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
PlayerId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayerSanctions", x => x.Id);
table.ForeignKey(
name: "FK_PlayerSanctions_Players_PlayerId",
column: x => x.PlayerId,
principalSchema: "Club12",
principalTable: "Players",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PlayersStatistics",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Value = table.Column<int>(type: "integer", nullable: false),
MatchId = table.Column<Guid>(type: "uuid", nullable: false),
PlayerId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayersStatistics", x => x.Id);
table.ForeignKey(
name: "FK_PlayersStatistics_Matches_MatchId",
column: x => x.MatchId,
principalSchema: "Club12",
principalTable: "Matches",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlayersStatistics_Players_PlayerId",
column: x => x.PlayerId,
principalSchema: "Club12",
principalTable: "Players",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Divisions_TournamentId",
schema: "Club12",
table: "Divisions",
column: "TournamentId");
migrationBuilder.CreateIndex(
name: "IX_Matches_DivisionId",
schema: "Club12",
table: "Matches",
column: "DivisionId");
migrationBuilder.CreateIndex(
name: "IX_Matches_HomeTeamId",
schema: "Club12",
table: "Matches",
column: "HomeTeamId");
migrationBuilder.CreateIndex(
name: "IX_Matches_VenueId",
schema: "Club12",
table: "Matches",
column: "VenueId");
migrationBuilder.CreateIndex(
name: "IX_Matches_VisitorTeamId",
schema: "Club12",
table: "Matches",
column: "VisitorTeamId");
migrationBuilder.CreateIndex(
name: "IX_Matches_WinningTeamId",
schema: "Club12",
table: "Matches",
column: "WinningTeamId");
migrationBuilder.CreateIndex(
name: "IX_Players_TeamId",
schema: "Club12",
table: "Players",
column: "TeamId");
migrationBuilder.CreateIndex(
name: "IX_PlayerSanctions_PlayerId",
schema: "Club12",
table: "PlayerSanctions",
column: "PlayerId");
migrationBuilder.CreateIndex(
name: "IX_PlayersStatistics_MatchId",
schema: "Club12",
table: "PlayersStatistics",
column: "MatchId");
migrationBuilder.CreateIndex(
name: "IX_PlayersStatistics_PlayerId",
schema: "Club12",
table: "PlayersStatistics",
column: "PlayerId");
migrationBuilder.CreateIndex(
name: "IX_Staffs_TeamId",
schema: "Club12",
table: "Staffs",
column: "TeamId");
migrationBuilder.CreateIndex(
name: "IX_Teams_DivisionId",
schema: "Club12",
table: "Teams",
column: "DivisionId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BlogPosts",
schema: "Club12");
migrationBuilder.DropTable(
name: "PlayerSanctions",
schema: "Club12");
migrationBuilder.DropTable(
name: "PlayersStatistics",
schema: "Club12");
migrationBuilder.DropTable(
name: "Staffs",
schema: "Club12");
migrationBuilder.DropTable(
name: "Users",
schema: "Club12");
migrationBuilder.DropTable(
name: "Matches",
schema: "Club12");
migrationBuilder.DropTable(
name: "Players",
schema: "Club12");
migrationBuilder.DropTable(
name: "Venues",
schema: "Club12");
migrationBuilder.DropTable(
name: "Teams",
schema: "Club12");
migrationBuilder.DropTable(
name: "Divisions",
schema: "Club12");
migrationBuilder.DropTable(
name: "Tournaments",
schema: "Club12");
}
}
@@ -0,0 +1,697 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250317005231_LatestChanges")]
partial class LatestChanges
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPostEntity.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.DivisionEntity.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.MatchEntity.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("GameNumber")
.HasColumnType("integer");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<int?>("MatchWeek")
.HasColumnType("integer");
b.Property<Guid?>("PlayoffSeriesId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("PlayoffSeriesId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerEntity.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Category")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Club")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<bool>("IsFederated")
.HasColumnType("boolean");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctionEntity.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatisticEntity.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayoffSeriesEntity.PlayoffSeries", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<int>("GamesRequiredToWin")
.HasColumnType("integer");
b.Property<int>("HomeTeamWins")
.HasColumnType("integer");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<Guid?>("NextSeriesId")
.HasColumnType("uuid");
b.Property<int>("RoundName")
.HasColumnType("integer");
b.Property<int>("VisitorTeamWins")
.HasColumnType("integer");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("NextSeriesId");
b.HasIndex("WinningTeamId");
b.ToTable("PlayoffSeries", "Club12");
});
modelBuilder.Entity("Entities.Models.StaffEntity.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.TeamEntity.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Seed")
.HasColumnType("integer");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.TournamentEntity.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.UserEntity.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.VenueEntity.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.DivisionEntity.Division", b =>
{
b.HasOne("Entities.Models.TournamentEntity.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.MatchEntity.Match", b =>
{
b.HasOne("Entities.Models.DivisionEntity.Division", "Division")
.WithMany("Matches")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.TeamEntity.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.PlayoffSeriesEntity.PlayoffSeries", "PlayoffSeries")
.WithMany("Matches")
.HasForeignKey("PlayoffSeriesId");
b.HasOne("Entities.Models.VenueEntity.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.TeamEntity.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.TeamEntity.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("Division");
b.Navigation("HomeTeam");
b.Navigation("PlayoffSeries");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerEntity.Player", b =>
{
b.HasOne("Entities.Models.TeamEntity.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.PlayerSanctionEntity.PlayerSanction", b =>
{
b.HasOne("Entities.Models.PlayerEntity.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatisticEntity.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.MatchEntity.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.PlayerEntity.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayoffSeriesEntity.PlayoffSeries", b =>
{
b.HasOne("Entities.Models.PlayoffSeriesEntity.PlayoffSeries", "NextSeries")
.WithMany()
.HasForeignKey("NextSeriesId");
b.HasOne("Entities.Models.TeamEntity.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("NextSeries");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.StaffEntity.Staff", b =>
{
b.HasOne("Entities.Models.TeamEntity.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.TeamEntity.Team", b =>
{
b.HasOne("Entities.Models.DivisionEntity.Division", "Division")
.WithMany("Teams")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.DivisionEntity.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.MatchEntity.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.PlayoffSeriesEntity.PlayoffSeries", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.TeamEntity.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.TournamentEntity.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,179 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class LatestChanges : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Teams_HomeTeamId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "RoundName",
schema: "Club12",
table: "Matches");
migrationBuilder.AddColumn<int>(
name: "Seed",
schema: "Club12",
table: "Teams",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<Guid>(
name: "HomeTeamId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddColumn<Guid>(
name: "PlayoffSeriesId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true);
migrationBuilder.CreateTable(
name: "PlayoffSeries",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
RoundName = table.Column<int>(type: "integer", nullable: false),
WinningTeamId = table.Column<Guid>(type: "uuid", nullable: true),
IsFinished = table.Column<bool>(type: "boolean", nullable: false),
GamesRequiredToWin = table.Column<int>(type: "integer", nullable: false),
HomeTeamWins = table.Column<int>(type: "integer", nullable: false),
VisitorTeamWins = table.Column<int>(type: "integer", nullable: false),
NextSeriesId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayoffSeries", x => x.Id);
table.ForeignKey(
name: "FK_PlayoffSeries_PlayoffSeries_NextSeriesId",
column: x => x.NextSeriesId,
principalSchema: "Club12",
principalTable: "PlayoffSeries",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PlayoffSeries_Teams_WinningTeamId",
column: x => x.WinningTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Matches_PlayoffSeriesId",
schema: "Club12",
table: "Matches",
column: "PlayoffSeriesId");
migrationBuilder.CreateIndex(
name: "IX_PlayoffSeries_NextSeriesId",
schema: "Club12",
table: "PlayoffSeries",
column: "NextSeriesId");
migrationBuilder.CreateIndex(
name: "IX_PlayoffSeries_WinningTeamId",
schema: "Club12",
table: "PlayoffSeries",
column: "WinningTeamId");
migrationBuilder.AddForeignKey(
name: "FK_Matches_PlayoffSeries_PlayoffSeriesId",
schema: "Club12",
table: "Matches",
column: "PlayoffSeriesId",
principalSchema: "Club12",
principalTable: "PlayoffSeries",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Teams_HomeTeamId",
schema: "Club12",
table: "Matches",
column: "HomeTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_PlayoffSeries_PlayoffSeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropForeignKey(
name: "FK_Matches_Teams_HomeTeamId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropTable(
name: "PlayoffSeries",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_Matches_PlayoffSeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "Seed",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "PlayoffSeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.AlterColumn<Guid>(
name: "HomeTeamId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: false,
defaultValue: Guid.Empty,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "RoundName",
schema: "Club12",
table: "Matches",
type: "text",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Matches_Teams_HomeTeamId",
schema: "Club12",
table: "Matches",
column: "HomeTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
@@ -0,0 +1,679 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250724231610_AddStageEntity")]
partial class AddStageEntity
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Category")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Club")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<bool>("IsFederated")
.HasColumnType("boolean");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Seed")
.HasColumnType("integer");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany()
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Teams")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,293 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class AddStageEntity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Divisions_DivisionId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropForeignKey(
name: "FK_Matches_PlayoffSeries_PlayoffSeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropForeignKey(
name: "FK_Matches_Venues_VenueId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropTable(
name: "PlayoffSeries",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_Matches_PlayoffSeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropIndex(
name: "IX_Matches_VenueId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "GameNumber",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "MatchWeek",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "PlayoffSeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "VenueId",
schema: "Club12",
table: "Matches");
migrationBuilder.AlterColumn<Guid>(
name: "DivisionId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddColumn<Guid>(
name: "StageId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: false,
defaultValue: Guid.Empty);
migrationBuilder.CreateTable(
name: "Stages",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
StageType = table.Column<string>(type: "text", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false),
IsElimination = table.Column<bool>(type: "boolean", nullable: false),
StartDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DivisionId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Stages", x => x.Id);
table.ForeignKey(
name: "FK_Stages_Divisions_DivisionId",
column: x => x.DivisionId,
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Matches_StageId",
schema: "Club12",
table: "Matches",
column: "StageId");
migrationBuilder.CreateIndex(
name: "IX_Stages_DivisionId",
schema: "Club12",
table: "Stages",
column: "DivisionId");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Divisions_DivisionId",
schema: "Club12",
table: "Matches",
column: "DivisionId",
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Stages_StageId",
schema: "Club12",
table: "Matches",
column: "StageId",
principalSchema: "Club12",
principalTable: "Stages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Divisions_DivisionId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropForeignKey(
name: "FK_Matches_Stages_StageId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropTable(
name: "Stages",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_Matches_StageId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "StageId",
schema: "Club12",
table: "Matches");
migrationBuilder.AlterColumn<Guid>(
name: "DivisionId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: false,
defaultValue: Guid.Empty,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddColumn<int>(
name: "GameNumber",
schema: "Club12",
table: "Matches",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "MatchWeek",
schema: "Club12",
table: "Matches",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "PlayoffSeriesId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "VenueId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true);
migrationBuilder.CreateTable(
name: "PlayoffSeries",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
NextSeriesId = table.Column<Guid>(type: "uuid", nullable: true),
WinningTeamId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
GamesRequiredToWin = table.Column<int>(type: "integer", nullable: false),
HomeTeamWins = table.Column<int>(type: "integer", nullable: false),
IsFinished = table.Column<bool>(type: "boolean", nullable: false),
RoundName = table.Column<int>(type: "integer", nullable: false),
VisitorTeamWins = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayoffSeries", x => x.Id);
table.ForeignKey(
name: "FK_PlayoffSeries_PlayoffSeries_NextSeriesId",
column: x => x.NextSeriesId,
principalSchema: "Club12",
principalTable: "PlayoffSeries",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PlayoffSeries_Teams_WinningTeamId",
column: x => x.WinningTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Matches_PlayoffSeriesId",
schema: "Club12",
table: "Matches",
column: "PlayoffSeriesId");
migrationBuilder.CreateIndex(
name: "IX_Matches_VenueId",
schema: "Club12",
table: "Matches",
column: "VenueId");
migrationBuilder.CreateIndex(
name: "IX_PlayoffSeries_NextSeriesId",
schema: "Club12",
table: "PlayoffSeries",
column: "NextSeriesId");
migrationBuilder.CreateIndex(
name: "IX_PlayoffSeries_WinningTeamId",
schema: "Club12",
table: "PlayoffSeries",
column: "WinningTeamId");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Divisions_DivisionId",
schema: "Club12",
table: "Matches",
column: "DivisionId",
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Matches_PlayoffSeries_PlayoffSeriesId",
schema: "Club12",
table: "Matches",
column: "PlayoffSeriesId",
principalSchema: "Club12",
principalTable: "PlayoffSeries",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Venues_VenueId",
schema: "Club12",
table: "Matches",
column: "VenueId",
principalSchema: "Club12",
principalTable: "Venues",
principalColumn: "Id");
}
}
@@ -0,0 +1,685 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250726012040_AddUniqueNameAndDivisionIdInsideStageTable")]
partial class AddUniqueNameAndDivisionIdInsideStageTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Category")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Club")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<bool>("IsFederated")
.HasColumnType("boolean");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Seed")
.HasColumnType("integer");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Teams")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class AddUniqueNameAndDivisionIdInsideStageTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID",
schema: "Club12",
table: "Stages",
columns: new[] { "Name", "DivisionId" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID",
schema: "Club12",
table: "Stages");
}
}
@@ -0,0 +1,678 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250729230926_removeFK_DivisionIdToTeam")]
partial class removeFK_DivisionIdToTeam
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Category")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Club")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<bool>("IsFederated")
.HasColumnType("boolean");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Teams")
.HasForeignKey("DivisionId");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class removeFK_DivisionIdToTeam : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Divisions_DivisionId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "Seed",
schema: "Club12",
table: "Teams");
migrationBuilder.AlterColumn<Guid>(
name: "DivisionId",
schema: "Club12",
table: "Teams",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddForeignKey(
name: "FK_Teams_Divisions_DivisionId",
schema: "Club12",
table: "Teams",
column: "DivisionId",
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Divisions_DivisionId",
schema: "Club12",
table: "Teams");
migrationBuilder.AlterColumn<Guid>(
name: "DivisionId",
schema: "Club12",
table: "Teams",
type: "uuid",
nullable: false,
defaultValue: Guid.Empty,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddColumn<int>(
name: "Seed",
schema: "Club12",
table: "Teams",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddForeignKey(
name: "FK_Teams_Divisions_DivisionId",
schema: "Club12",
table: "Teams",
column: "DivisionId",
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
@@ -0,0 +1,674 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250731014937_AddContraintToUniqueDocumentNumberInsidePlayerTable")]
partial class AddContraintToUniqueDocumentNumberInsidePlayerTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Teams")
.HasForeignKey("DivisionId");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,93 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class AddContraintToUniqueDocumentNumberInsidePlayerTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Category",
schema: "Club12",
table: "Players");
migrationBuilder.DropColumn(
name: "Club",
schema: "Club12",
table: "Players");
migrationBuilder.DropColumn(
name: "IsFederated",
schema: "Club12",
table: "Players");
migrationBuilder.RenameColumn(
name: "Names",
schema: "Club12",
table: "Players",
newName: "FirstName");
migrationBuilder.AddColumn<string>(
name: "SecondName",
schema: "Club12",
table: "Players",
type: "character varying(70)",
maxLength: 70,
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Players_DocumentNumber",
schema: "Club12",
table: "Players",
column: "DocumentNumber",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Players_DocumentNumber",
schema: "Club12",
table: "Players");
migrationBuilder.DropColumn(
name: "SecondName",
schema: "Club12",
table: "Players");
migrationBuilder.RenameColumn(
name: "FirstName",
schema: "Club12",
table: "Players",
newName: "Names");
migrationBuilder.AddColumn<string>(
name: "Category",
schema: "Club12",
table: "Players",
type: "character varying(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Club",
schema: "Club12",
table: "Players",
type: "character varying(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsFederated",
schema: "Club12",
table: "Players",
type: "boolean",
nullable: false,
defaultValue: false);
}
}
@@ -0,0 +1,685 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250801010149_addVenueIntoMatch")]
partial class addVenueIntoMatch
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Teams")
.HasForeignKey("DivisionId");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class addVenueIntoMatch : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "VenueId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Matches_VenueId",
schema: "Club12",
table: "Matches",
column: "VenueId");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Venues_VenueId",
schema: "Club12",
table: "Matches",
column: "VenueId",
principalSchema: "Club12",
principalTable: "Venues",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Venues_VenueId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropIndex(
name: "IX_Matches_VenueId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "VenueId",
schema: "Club12",
table: "Matches");
}
}
@@ -0,0 +1,685 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250804000142_ChangeDateTimeWithTimeZoneToDateTimeWithoutTimeZone")]
partial class ChangeDateTimeWithTimeZoneToDateTimeWithoutTimeZone
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Teams")
.HasForeignKey("DivisionId");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,585 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class ChangeDateTimeWithTimeZoneToDateTimeWithoutTimeZone : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Venues",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Venues",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "RefreshTokenExpiryTime",
schema: "Club12",
table: "Users",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Users",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Users",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Tournaments",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Tournaments",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Teams",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Teams",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
schema: "Club12",
table: "Stages",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "EndDate",
schema: "Club12",
table: "Stages",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Stages",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Stages",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Staffs",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Staffs",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "PlayersStatistics",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "PlayersStatistics",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "IssuedDate",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Players",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Players",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "BirthDate",
schema: "Club12",
table: "Players",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "MatchDate",
schema: "Club12",
table: "Matches",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Matches",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Matches",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Divisions",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Divisions",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "BlogPosts",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "BlogPosts",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Venues",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Venues",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "RefreshTokenExpiryTime",
schema: "Club12",
table: "Users",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Users",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Users",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Tournaments",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Tournaments",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Teams",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Teams",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
schema: "Club12",
table: "Stages",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "EndDate",
schema: "Club12",
table: "Stages",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Stages",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Stages",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Staffs",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Staffs",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "PlayersStatistics",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "PlayersStatistics",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "IssuedDate",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Players",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Players",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "BirthDate",
schema: "Club12",
table: "Players",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "MatchDate",
schema: "Club12",
table: "Matches",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Matches",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Matches",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "Divisions",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "Divisions",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "DateUpdated",
schema: "Club12",
table: "BlogPosts",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateCreated",
schema: "Club12",
table: "BlogPosts",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
}
}
@@ -0,0 +1,698 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250809010120_addMatchIdIntoPlayerSanctionEntity")]
partial class addMatchIdIntoPlayerSanctionEntity
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12");
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Teams")
.HasForeignKey("DivisionId");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class addMatchIdIntoPlayerSanctionEntity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "MatchId",
schema: "Club12",
table: "PlayerSanctions",
type: "uuid",
nullable: false,
defaultValue: Guid.Empty);
migrationBuilder.CreateIndex(
name: "IX_PlayerSanctions_MatchId",
schema: "Club12",
table: "PlayerSanctions",
column: "MatchId");
migrationBuilder.AddForeignKey(
name: "FK_PlayerSanctions_Matches_MatchId",
schema: "Club12",
table: "PlayerSanctions",
column: "MatchId",
principalSchema: "Club12",
principalTable: "Matches",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlayerSanctions_Matches_MatchId",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropIndex(
name: "IX_PlayerSanctions_MatchId",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "MatchId",
schema: "Club12",
table: "PlayerSanctions");
}
}
@@ -0,0 +1,729 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20250816164236_AddChangesInTournamentEntity")]
partial class AddChangesInTournamentEntity
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<bool>("PlayoffsGenerated")
.HasColumnType("boolean");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid?>("DivisionId")
.HasColumnType("uuid");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "[TeamRegistrationDeadline] < [StartDate]");
});
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Matches")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Divisions.Division", null)
.WithMany("Teams")
.HasForeignKey("DivisionId");
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Matches");
b.Navigation("Stages");
b.Navigation("Teams");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,132 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class AddChangesInTournamentEntity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsFinished",
schema: "Club12",
table: "Tournaments",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "MaxTeams",
schema: "Club12",
table: "Tournaments",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "MinTeams",
schema: "Club12",
table: "Tournaments",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "StartDate",
schema: "Club12",
table: "Tournaments",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(2, 2, 2, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "TeamRegistrationDeadline",
schema: "Club12",
table: "Tournaments",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "TournamentId",
schema: "Club12",
table: "Teams",
type: "uuid",
nullable: true);
migrationBuilder.AddCheckConstraint(
name: "CK_Tournament_DeadlineBeforeStart",
schema: "Club12",
table: "Tournaments",
sql: "\"TeamRegistrationDeadline\" < \"StartDate\"");
migrationBuilder.CreateIndex(
name: "IX_Teams_TournamentId",
schema: "Club12",
table: "Teams",
column: "TournamentId");
migrationBuilder.AddForeignKey(
name: "FK_Teams_Tournaments_TournamentId",
schema: "Club12",
table: "Teams",
column: "TournamentId",
principalSchema: "Club12",
principalTable: "Tournaments",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Tournaments_TournamentId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropCheckConstraint(
name: "CK_Tournament_DeadlineBeforeStart",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropIndex(
name: "IX_Teams_TournamentId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "IsFinished",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "MaxTeams",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "MinTeams",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "StartDate",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "TeamRegistrationDeadline",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "TournamentId",
schema: "Club12",
table: "Teams");
}
}
@@ -0,0 +1,707 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260201150715_ChangesEntities")]
partial class ChangesEntities
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("CanGenerateStageAutomated")
.HasColumnType("boolean");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,139 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class ChangesEntities : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Divisions_DivisionId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropForeignKey(
name: "FK_Teams_Divisions_DivisionId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropCheckConstraint(
name: "CK_Tournament_DeadlineBeforeStart",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropIndex(
name: "IX_Teams_DivisionId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropIndex(
name: "IX_Matches_DivisionId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "DivisionId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "DivisionId",
schema: "Club12",
table: "Matches");
migrationBuilder.RenameColumn(
name: "PlayoffsGenerated",
schema: "Club12",
table: "Divisions",
newName: "CanGenerateStageAutomated");
migrationBuilder.AddCheckConstraint(
name: "CK_Tournament_DeadlineBeforeStart",
schema: "Club12",
table: "Tournaments",
sql: "\"TeamRegistrationDeadline\" < \"StartDate\"");
migrationBuilder.Sql(
@"
UPDATE
""Club12"".""Divisions""
SET
""CanGenerateStageAutomated"" = CASE
WHEN (SELECT COUNT(*) FROM ""Club12"".""Stages"" WHERE ""Stages"".""DivisionId"" = ""Divisions"".""Id"") = 0 THEN TRUE
ELSE FALSE
END
"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropCheckConstraint(
name: "CK_Tournament_DeadlineBeforeStart",
schema: "Club12",
table: "Tournaments");
migrationBuilder.RenameColumn(
name: "CanGenerateStageAutomated",
schema: "Club12",
table: "Divisions",
newName: "PlayoffsGenerated");
migrationBuilder.AddColumn<Guid>(
name: "DivisionId",
schema: "Club12",
table: "Teams",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DivisionId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true);
migrationBuilder.AddCheckConstraint(
name: "CK_Tournament_DeadlineBeforeStart",
schema: "Club12",
table: "Tournaments",
sql: "\"TeamRegistrationDeadline\" < \"StartDate\"");
migrationBuilder.CreateIndex(
name: "IX_Teams_DivisionId",
schema: "Club12",
table: "Teams",
column: "DivisionId");
migrationBuilder.CreateIndex(
name: "IX_Matches_DivisionId",
schema: "Club12",
table: "Matches",
column: "DivisionId");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Divisions_DivisionId",
schema: "Club12",
table: "Matches",
column: "DivisionId",
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Teams_Divisions_DivisionId",
schema: "Club12",
table: "Teams",
column: "DivisionId",
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id");
}
}
@@ -0,0 +1,710 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260204033209_addOrderColumnIntoStage")]
partial class addOrderColumnIntoStage
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("CanGenerateStageAutomated")
.HasColumnType("boolean");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class addOrderColumnIntoStage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Order",
schema: "Club12",
table: "Stages",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Order",
schema: "Club12",
table: "Stages");
}
}
@@ -0,0 +1,705 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260205004338_removeUnneccessaryProp")]
partial class removeUnneccessaryProp
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class removeUnneccessaryProp : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Teams_VisitorTeamId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "CanGenerateStageAutomated",
schema: "Club12",
table: "Divisions");
migrationBuilder.AlterColumn<Guid>(
name: "VisitorTeamId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddForeignKey(
name: "FK_Matches_Teams_VisitorTeamId",
schema: "Club12",
table: "Matches",
column: "VisitorTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_Teams_VisitorTeamId",
schema: "Club12",
table: "Matches");
migrationBuilder.AlterColumn<Guid>(
name: "VisitorTeamId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: false,
defaultValue: Guid.Empty,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddColumn<bool>(
name: "CanGenerateStageAutomated",
schema: "Club12",
table: "Divisions",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddForeignKey(
name: "FK_Matches_Teams_VisitorTeamId",
schema: "Club12",
table: "Matches",
column: "VisitorTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
@@ -0,0 +1,757 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260218023223_AddStageTeamMatchTable")]
partial class AddStageTeamMatchTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Entities.Models.BlogPosts.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Names")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeamId");
b.ToTable("Staffs", "Club12");
});
modelBuilder.Entity("Entities.Models.StageTeamMatches.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Entities.Models.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("RefreshToken")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("character varying(25)");
b.HasKey("Id");
b.ToTable("Users", "Club12");
});
modelBuilder.Entity("Entities.Models.Venues.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateCreated");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone")
.HasColumnName("DateUpdated");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.HasOne("Entities.Models.Teams.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Venues.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Entities.Models.Teams.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Entities.Models.Teams.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Entities.Models.PlayerSanctions.PlayerSanction", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.PlayerStatistics.PlayerStatistic", b =>
{
b.HasOne("Entities.Models.Matches.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Players.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Entities.Models.Players.Player", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Staffs.Staff", b =>
{
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("Staff")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.StageTeamMatches.StageTeamMatch", b =>
{
b.HasOne("Entities.Models.Stages.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Models.Teams.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.HasOne("Entities.Models.Divisions.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.HasOne("Entities.Models.Tournaments.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Entities.Models.Divisions.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Entities.Models.Matches.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Entities.Models.Stages.Stage", b =>
{
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Entities.Models.Teams.Team", b =>
{
b.Navigation("Players");
b.Navigation("Staff");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Entities.Models.Tournaments.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,65 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class AddStageTeamMatchTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StageTeamMatches",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
StageId = table.Column<Guid>(type: "uuid", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_StageTeamMatches", x => x.Id);
table.ForeignKey(
name: "FK_StageTeamMatches_Stages_StageId",
column: x => x.StageId,
principalSchema: "Club12",
principalTable: "Stages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StageTeamMatches_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_StageTeamMatches_StageId",
schema: "Club12",
table: "StageTeamMatches",
column: "StageId");
migrationBuilder.CreateIndex(
name: "IX_StageTeamMatches_TeamId",
schema: "Club12",
table: "StageTeamMatches",
column: "TeamId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StageTeamMatches",
schema: "Club12");
}
}
@@ -0,0 +1,748 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260315232746_cleanDB")]
partial class cleanDB
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,474 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class cleanDB : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Staffs",
schema: "Club12");
migrationBuilder.DropTable(
name: "Users",
schema: "Club12");
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Venues",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Venues",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Tournaments",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Tournaments",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Teams",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Teams",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "StageTeamMatches",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "StageTeamMatches",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Stages",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Stages",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "PlayersStatistics",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "PlayersStatistics",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "PlayerSanctions",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "PlayerSanctions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Players",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Players",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Matches",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Matches",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "Divisions",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "Divisions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
schema: "Club12",
table: "BlogPosts",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
schema: "Club12",
table: "BlogPosts",
type: "text",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Venue_CreatedAt",
schema: "Club12",
table: "Venues",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Tournament_CreatedAt",
schema: "Club12",
table: "Tournaments",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Team_CreatedAt",
schema: "Club12",
table: "Teams",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_StageTeamMatch_CreatedAt",
schema: "Club12",
table: "StageTeamMatches",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Stage_CreatedAt",
schema: "Club12",
table: "Stages",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_PlayerStatistic_CreatedAt",
schema: "Club12",
table: "PlayersStatistics",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_PlayerSanction_CreatedAt",
schema: "Club12",
table: "PlayerSanctions",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Player_CreatedAt",
schema: "Club12",
table: "Players",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Match_CreatedAt",
schema: "Club12",
table: "Matches",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Division_CreatedAt",
schema: "Club12",
table: "Divisions",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_BlogPost_CreatedAt",
schema: "Club12",
table: "BlogPosts",
column: "DateCreated");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Venue_CreatedAt",
schema: "Club12",
table: "Venues");
migrationBuilder.DropIndex(
name: "IX_Tournament_CreatedAt",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropIndex(
name: "IX_Team_CreatedAt",
schema: "Club12",
table: "Teams");
migrationBuilder.DropIndex(
name: "IX_StageTeamMatch_CreatedAt",
schema: "Club12",
table: "StageTeamMatches");
migrationBuilder.DropIndex(
name: "IX_Stage_CreatedAt",
schema: "Club12",
table: "Stages");
migrationBuilder.DropIndex(
name: "IX_PlayerStatistic_CreatedAt",
schema: "Club12",
table: "PlayersStatistics");
migrationBuilder.DropIndex(
name: "IX_PlayerSanction_CreatedAt",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropIndex(
name: "IX_Player_CreatedAt",
schema: "Club12",
table: "Players");
migrationBuilder.DropIndex(
name: "IX_Match_CreatedAt",
schema: "Club12",
table: "Matches");
migrationBuilder.DropIndex(
name: "IX_Division_CreatedAt",
schema: "Club12",
table: "Divisions");
migrationBuilder.DropIndex(
name: "IX_BlogPost_CreatedAt",
schema: "Club12",
table: "BlogPosts");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Venues");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Venues");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "StageTeamMatches");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "StageTeamMatches");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Stages");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Stages");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "PlayersStatistics");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "PlayersStatistics");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Players");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Players");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "Divisions");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "Divisions");
migrationBuilder.DropColumn(
name: "CreatedBy",
schema: "Club12",
table: "BlogPosts");
migrationBuilder.DropColumn(
name: "UpdatedBy",
schema: "Club12",
table: "BlogPosts");
migrationBuilder.CreateTable(
name: "Staffs",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
LastName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Names = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
PhoneNumber = table.Column<string>(type: "character varying(15)", maxLength: 15, nullable: false),
Type = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Staffs", x => x.Id);
table.ForeignKey(
name: "FK_Staffs_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Users",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Password = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
RefreshToken = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
RefreshTokenExpiryTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Role = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
Username = table.Column<string>(type: "character varying(25)", maxLength: 25, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Staffs_TeamId",
schema: "Club12",
table: "Staffs",
column: "TeamId");
}
}
@@ -0,0 +1,750 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260326234428_changeTournamentEntity")]
partial class changeTournamentEntity
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class changeTournamentEntity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsFinished",
schema: "Club12",
table: "Tournaments");
migrationBuilder.AddColumn<int>(
name: "Status",
schema: "Club12",
table: "Tournaments",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Status",
schema: "Club12",
table: "Tournaments");
migrationBuilder.AddColumn<bool>(
name: "IsFinished",
schema: "Club12",
table: "Tournaments",
type: "boolean",
nullable: false,
defaultValue: false);
}
}
@@ -0,0 +1,816 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Persistance.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260403194406_AddScorerTable")]
partial class AddScorerTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Points")
.HasColumnType("integer");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Scorer_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("Scorers", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("Scorers")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany("Scorers")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,74 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Persistance.Migrations;
/// <inheritdoc />
public partial class AddScorerTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Scorers",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
PlayerId = table.Column<Guid>(type: "uuid", nullable: false),
Points = table.Column<int>(type: "integer", nullable: false),
MatchId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Scorers", x => x.Id);
table.ForeignKey(
name: "FK_Scorers_Matches_MatchId",
column: x => x.MatchId,
principalSchema: "Club12",
principalTable: "Matches",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Scorers_Players_PlayerId",
column: x => x.PlayerId,
principalSchema: "Club12",
principalTable: "Players",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Scorer_CreatedAt",
schema: "Club12",
table: "Scorers",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Scorers_MatchId",
schema: "Club12",
table: "Scorers",
column: "MatchId");
migrationBuilder.CreateIndex(
name: "IX_Scorers_PlayerId",
schema: "Club12",
table: "Scorers",
column: "PlayerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Scorers",
schema: "Club12");
}
}
@@ -0,0 +1,820 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260629150628_AddPlayerStatisticType")]
partial class AddPlayerStatisticType
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Points")
.HasColumnType("integer");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Scorer_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("Scorers", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("Scorers")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany("Scorers")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddPlayerStatisticType : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Type",
schema: "Club12",
table: "PlayersStatistics",
type: "text",
nullable: false,
defaultValue: "Points");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Type",
schema: "Club12",
table: "PlayersStatistics");
}
}
@@ -0,0 +1,838 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260629151546_AddSanctionAppeal")]
partial class AddSanctionAppeal
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime?>("AppealDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealReason")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("AppealResolution")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<DateTime?>("AppealResolvedDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealStatus")
.IsRequired()
.HasColumnType("text");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Points")
.HasColumnType("integer");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Scorer_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("Scorers", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("Scorers")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany("Scorers")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,82 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddSanctionAppeal : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "AppealDate",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AppealReason",
schema: "Club12",
table: "PlayerSanctions",
type: "character varying(1000)",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AppealResolution",
schema: "Club12",
table: "PlayerSanctions",
type: "character varying(1000)",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "AppealResolvedDate",
schema: "Club12",
table: "PlayerSanctions",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AppealStatus",
schema: "Club12",
table: "PlayerSanctions",
type: "text",
nullable: false,
defaultValue: "None");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AppealDate",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "AppealReason",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "AppealResolution",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "AppealResolvedDate",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "AppealStatus",
schema: "Club12",
table: "PlayerSanctions");
}
}
@@ -0,0 +1,959 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260816030250_AddPlayoffSeriesAndBracketName")]
partial class AddPlayoffSeriesAndBracketName
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.30")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsCrossDivisionCup")
.HasColumnType("boolean");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("GameNumber")
.HasColumnType("integer");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid?>("SeriesId")
.HasColumnType("uuid");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("SeriesId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BestOf")
.HasColumnType("integer");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("HomeTeamId")
.HasColumnType("uuid");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_MatchSeries_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("MatchSeries", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime?>("AppealDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealReason")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("AppealResolution")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<DateTime?>("AppealResolvedDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealStatus")
.IsRequired()
.HasColumnType("text");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Points")
.HasColumnType("integer");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Scorer_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("Scorers", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BestOf")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("BracketName")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<int>("RoundRobinLegs")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.MatchSeries", "Series")
.WithMany("Matches")
.HasForeignKey("SeriesId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Series");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("MatchSeries")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("Scorers")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany("Scorers")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("MatchSeries");
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,202 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddPlayoffSeriesAndBracketName : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "BestOf",
schema: "Club12",
table: "Stages",
type: "integer",
nullable: false,
defaultValue: 1);
migrationBuilder.AddColumn<string>(
name: "BracketName",
schema: "Club12",
table: "Stages",
type: "character varying(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "RoundRobinLegs",
schema: "Club12",
table: "Stages",
type: "integer",
nullable: false,
defaultValue: 1);
migrationBuilder.AddColumn<int>(
name: "GameNumber",
schema: "Club12",
table: "Matches",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "SeriesId",
schema: "Club12",
table: "Matches",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsCrossDivisionCup",
schema: "Club12",
table: "Divisions",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "MatchSeries",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
StageId = table.Column<Guid>(type: "uuid", nullable: false),
HomeTeamId = table.Column<Guid>(type: "uuid", nullable: false),
VisitorTeamId = table.Column<Guid>(type: "uuid", nullable: false),
BestOf = table.Column<int>(type: "integer", nullable: false),
WinningTeamId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MatchSeries", x => x.Id);
table.ForeignKey(
name: "FK_MatchSeries_Stages_StageId",
column: x => x.StageId,
principalSchema: "Club12",
principalTable: "Stages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MatchSeries_Teams_HomeTeamId",
column: x => x.HomeTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MatchSeries_Teams_VisitorTeamId",
column: x => x.VisitorTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MatchSeries_Teams_WinningTeamId",
column: x => x.WinningTeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Matches_SeriesId",
schema: "Club12",
table: "Matches",
column: "SeriesId");
migrationBuilder.CreateIndex(
name: "IX_MatchSeries_CreatedAt",
schema: "Club12",
table: "MatchSeries",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_MatchSeries_HomeTeamId",
schema: "Club12",
table: "MatchSeries",
column: "HomeTeamId");
migrationBuilder.CreateIndex(
name: "IX_MatchSeries_StageId",
schema: "Club12",
table: "MatchSeries",
column: "StageId");
migrationBuilder.CreateIndex(
name: "IX_MatchSeries_VisitorTeamId",
schema: "Club12",
table: "MatchSeries",
column: "VisitorTeamId");
migrationBuilder.CreateIndex(
name: "IX_MatchSeries_WinningTeamId",
schema: "Club12",
table: "MatchSeries",
column: "WinningTeamId");
migrationBuilder.AddForeignKey(
name: "FK_Matches_MatchSeries_SeriesId",
schema: "Club12",
table: "Matches",
column: "SeriesId",
principalSchema: "Club12",
principalTable: "MatchSeries",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Matches_MatchSeries_SeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropTable(
name: "MatchSeries",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_Matches_SeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "BestOf",
schema: "Club12",
table: "Stages");
migrationBuilder.DropColumn(
name: "BracketName",
schema: "Club12",
table: "Stages");
migrationBuilder.DropColumn(
name: "RoundRobinLegs",
schema: "Club12",
table: "Stages");
migrationBuilder.DropColumn(
name: "GameNumber",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "SeriesId",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "IsCrossDivisionCup",
schema: "Club12",
table: "Divisions");
}
}
@@ -0,0 +1,975 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260817044123_AddSlugToTournamentAndTeam")]
partial class AddSlugToTournamentAndTeam
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.30")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsCrossDivisionCup")
.HasColumnType("boolean");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("GameNumber")
.HasColumnType("integer");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid?>("SeriesId")
.HasColumnType("uuid");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("SeriesId");
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BestOf")
.HasColumnType("integer");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("HomeTeamId")
.HasColumnType("uuid");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_MatchSeries_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("MatchSeries", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime?>("AppealDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealReason")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("AppealResolution")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<DateTime?>("AppealResolvedDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealStatus")
.IsRequired()
.HasColumnType("text");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Points")
.HasColumnType("integer");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Scorer_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("Scorers", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BestOf")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("BracketName")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<int>("RoundRobinLegs")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(220)
.HasColumnType("character varying(220)");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(220)
.HasColumnType("character varying(220)");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.MatchSeries", "Series")
.WithMany("Matches")
.HasForeignKey("SeriesId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Series");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("MatchSeries")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("Scorers")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany("Scorers")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("MatchSeries");
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,146 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddSlugToTournamentAndTeam : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Tournaments",
type: "character varying(220)",
maxLength: 220,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Teams",
type: "character varying(220)",
maxLength: 220,
nullable: true);
// Backfills every existing row's Slug from its current Name, mirroring
// SlugGenerator.GenerateSlug (lowercase, accented characters
// transliterated to their base letter, non-alphanumeric runs collapsed
// to a single hyphen, leading/trailing hyphens trimmed). Rows whose
// computed base slug collides get a numeric suffix (-2, -3, ...)
// ordered by Id, the same disambiguation strategy SlugGenerator uses
// for newly created rows.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Tournaments""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Tournaments"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Teams""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Teams"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Tournaments",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Teams",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_Tournaments_Slug",
schema: "Club12",
table: "Tournaments",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Teams_Slug",
schema: "Club12",
table: "Teams",
column: "Slug",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Tournaments_Slug",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropIndex(
name: "IX_Teams_Slug",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Teams");
}
}
@@ -0,0 +1,983 @@
// <auto-generated />
using System;
using Infrastructure.Persistance;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDBContext))]
[Migration("20260817064644_AddSlugToMatch")]
partial class AddSlugToMatch
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.30")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Models.BlogPost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("MarkdownText")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhotoUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_BlogPost_CreatedAt");
b.ToTable("BlogPosts", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsCrossDivisionCup")
.HasColumnType("boolean");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<Guid>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Division_CreatedAt");
b.HasIndex("TournamentId");
b.ToTable("Divisions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<int?>("GameNumber")
.HasColumnType("integer");
b.Property<int?>("HomeScore")
.HasColumnType("integer");
b.Property<Guid?>("HomeTeamId")
.HasColumnType("uuid");
b.Property<bool>("IsFinished")
.HasColumnType("boolean");
b.Property<DateTime>("MatchDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid?>("SeriesId")
.HasColumnType("uuid");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(220)
.HasColumnType("character varying(220)");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid?>("VenueId")
.HasColumnType("uuid");
b.Property<int?>("VisitorScore")
.HasColumnType("integer");
b.Property<Guid?>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Match_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("SeriesId");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("StageId");
b.HasIndex("VenueId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("Matches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BestOf")
.HasColumnType("integer");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("HomeTeamId")
.HasColumnType("uuid");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<Guid>("VisitorTeamId")
.HasColumnType("uuid");
b.Property<Guid?>("WinningTeamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_MatchSeries_CreatedAt");
b.HasIndex("HomeTeamId");
b.HasIndex("StageId");
b.HasIndex("VisitorTeamId");
b.HasIndex("WinningTeamId");
b.ToTable("MatchSeries", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("DocumentNumber")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("character varying(15)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<bool>("IsSanctioned")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<string>("SecondName")
.HasMaxLength(70)
.HasColumnType("character varying(70)");
b.Property<string>("SocialSecurity")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Player_CreatedAt");
b.HasIndex("DocumentNumber")
.IsUnique();
b.HasIndex("TeamId");
b.ToTable("Players", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime?>("AppealDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealReason")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("AppealResolution")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<DateTime?>("AppealResolvedDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("AppealStatus")
.IsRequired()
.HasColumnType("text");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("Duration")
.HasColumnType("integer");
b.Property<DateTime>("IssuedDate")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerSanction_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayerSanctions", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<int>("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_PlayerStatistic_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("PlayersStatistics", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("MatchId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerId")
.HasColumnType("uuid");
b.Property<int>("Points")
.HasColumnType("integer");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Scorer_CreatedAt");
b.HasIndex("MatchId");
b.HasIndex("PlayerId");
b.ToTable("Scorers", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BestOf")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("BracketName")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<Guid>("DivisionId")
.HasColumnType("uuid");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsElimination")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<int>("RoundRobinLegs")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("StageType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Stage_CreatedAt");
b.HasIndex("DivisionId");
b.HasIndex("Name", "DivisionId")
.IsUnique()
.HasDatabaseName("CONSTRAINT_UNIQUE_STAGE_NAME_AND_DIVISIONID");
b.ToTable("Stages", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<Guid>("StageId")
.HasColumnType("uuid");
b.Property<Guid>("TeamId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_StageTeamMatch_CreatedAt");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("StageTeamMatches", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ShirtColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(220)
.HasColumnType("character varying(220)");
b.Property<string>("ThreeLetterCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("TournamentId")
.HasColumnType("uuid");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Team_CreatedAt");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("TournamentId");
b.ToTable("Teams", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxTeams")
.HasColumnType("integer");
b.Property<int>("MinTeams")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(220)
.HasColumnType("character varying(220)");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime>("TeamRegistrationDeadline")
.HasColumnType("timestamp without time zone");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Tournament_CreatedAt");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tournaments", "Club12", t =>
{
t.HasCheckConstraint("CK_Tournament_DeadlineBeforeStart", "\"TeamRegistrationDeadline\" < \"StartDate\"");
});
});
modelBuilder.Entity("Domain.Entities.Models.Venue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("PhotoUrl")
.HasColumnType("text");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DateCreated")
.HasDatabaseName("IX_Venue_CreatedAt");
b.ToTable("Venues", "Club12");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Divisions")
.HasForeignKey("TournamentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId");
b.HasOne("Domain.Entities.Models.MatchSeries", "Series")
.WithMany("Matches")
.HasForeignKey("SeriesId");
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("Matches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Venue", "Venue")
.WithMany()
.HasForeignKey("VenueId");
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId");
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Series");
b.Navigation("Stage");
b.Navigation("Venue");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.HasOne("Domain.Entities.Models.Team", "HomeTeam")
.WithMany()
.HasForeignKey("HomeTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("MatchSeries")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "VisitorTeam")
.WithMany()
.HasForeignKey("VisitorTeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "WinningTeam")
.WithMany()
.HasForeignKey("WinningTeamId");
b.Navigation("HomeTeam");
b.Navigation("Stage");
b.Navigation("VisitorTeam");
b.Navigation("WinningTeam");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("Players")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerSanction", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany()
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.PlayerStatistic", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("PlayerStatistics")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Scorer", b =>
{
b.HasOne("Domain.Entities.Models.Match", "Match")
.WithMany("Scorers")
.HasForeignKey("MatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Player", "Player")
.WithMany("Scorers")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Match");
b.Navigation("Player");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.HasOne("Domain.Entities.Models.Division", "Division")
.WithMany("Stages")
.HasForeignKey("DivisionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Division");
});
modelBuilder.Entity("Domain.Entities.Models.StageTeamMatch", b =>
{
b.HasOne("Domain.Entities.Models.Stage", "Stage")
.WithMany("StageTeamMatches")
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.Models.Team", "Team")
.WithMany("StageTeamMatches")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stage");
b.Navigation("Team");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.HasOne("Domain.Entities.Models.Tournament", "Tournament")
.WithMany("Teams")
.HasForeignKey("TournamentId");
b.Navigation("Tournament");
});
modelBuilder.Entity("Domain.Entities.Models.Division", b =>
{
b.Navigation("Stages");
});
modelBuilder.Entity("Domain.Entities.Models.Match", b =>
{
b.Navigation("PlayerStatistics");
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.MatchSeries", b =>
{
b.Navigation("Matches");
});
modelBuilder.Entity("Domain.Entities.Models.Player", b =>
{
b.Navigation("Scorers");
});
modelBuilder.Entity("Domain.Entities.Models.Stage", b =>
{
b.Navigation("MatchSeries");
b.Navigation("Matches");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Team", b =>
{
b.Navigation("Players");
b.Navigation("StageTeamMatches");
});
modelBuilder.Entity("Domain.Entities.Models.Tournament", b =>
{
b.Navigation("Divisions");
b.Navigation("Teams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,98 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddSlugToMatch : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Matches",
type: "character varying(220)",
maxLength: 220,
nullable: true);
// Backfills every existing match's Slug from its home/visitor team names
// and match date, mirroring MatchSlugSourceBuilder.Build + SlugGenerator.GenerateSlug
// ("{homeTeamName} vs {visitorTeamName} {yyyy-MM-dd}", lowercased, accented
// characters transliterated to their base letter, non-alphanumeric runs
// collapsed to a single hyphen, leading/trailing hyphens trimmed). A team
// missing from either side (unseeded match) falls back to the same "TBD"
// placeholder the application uses. Rows whose computed base slug collides
// (e.g. two legs between the same pairing on the same day, or several
// unseeded matches) get a numeric suffix (-2, -3, ...) ordered by Id, the
// same disambiguation strategy SlugGenerator uses for newly created rows.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT m.""Id"",
trim(both '-' from
regexp_replace(
translate(
lower(
concat(
COALESCE(ht.""Name"", 'TBD'), ' vs ', COALESCE(vt.""Name"", 'TBD'),
' ', to_char(m.""MatchDate"", 'YYYY-MM-DD')
)
),
'áéíóúüñ', 'aeiouun'
),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Matches"" m
LEFT JOIN ""Club12"".""Teams"" ht ON ht.""Id"" = m.""HomeTeamId""
LEFT JOIN ""Club12"".""Teams"" vt ON vt.""Id"" = m.""VisitorTeamId""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Matches"" m
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE m.""Id"" = n.""Id"";
"
);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Matches",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_Matches_Slug",
schema: "Club12",
table: "Matches",
column: "Slug",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Matches_Slug",
schema: "Club12",
table: "Matches");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Matches");
}
}
@@ -0,0 +1,115 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddPlayerTeamRegistrationTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PlayerTeamRegistrations",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
PlayerId = table.Column<Guid>(type: "uuid", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
TournamentId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayerTeamRegistrations", x => x.Id);
table.ForeignKey(
name: "FK_PlayerTeamRegistrations_Players_PlayerId",
column: x => x.PlayerId,
principalSchema: "Club12",
principalTable: "Players",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlayerTeamRegistrations_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlayerTeamRegistrations_Tournaments_TournamentId",
column: x => x.TournamentId,
principalSchema: "Club12",
principalTable: "Tournaments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PlayerTeamRegistration_CreatedAt",
schema: "Club12",
table: "PlayerTeamRegistrations",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_PlayerTeamRegistrations_PlayerId_TournamentId",
schema: "Club12",
table: "PlayerTeamRegistrations",
columns: new[] { "PlayerId", "TournamentId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_PlayerTeamRegistrations_TeamId",
schema: "Club12",
table: "PlayerTeamRegistrations",
column: "TeamId");
migrationBuilder.CreateIndex(
name: "IX_PlayerTeamRegistrations_TournamentId",
schema: "Club12",
table: "PlayerTeamRegistrations",
column: "TournamentId");
// Data backfill: every existing player's CURRENT team assignment
// (Players.TeamId) becomes a season-scoped registration for
// whatever tournament that team is CURRENTLY assigned to
// (Teams.TournamentId at the time this migration runs). This
// preserves today's roster attribution exactly as-is — e.g. a
// player on a team currently pointed at "Apertura Club 12 2026"
// gets a registration for that same tournament, a player on a
// team currently pointed at "Femenino Club12 La Vuelta" gets a
// registration for that one. Players whose team has no current
// tournament (Teams.TournamentId IS NULL) are skipped: there is
// no season to attribute them to.
migrationBuilder.Sql(
"""
INSERT INTO "Club12"."PlayerTeamRegistrations"
("Id", "PlayerId", "TeamId", "TournamentId", "DateCreated", "CreatedBy")
SELECT
gen_random_uuid(),
p."Id",
p."TeamId",
t."TournamentId",
p."DateCreated",
'System'
FROM "Club12"."Players" p
JOIN "Club12"."Teams" t ON t."Id" = p."TeamId"
WHERE t."TournamentId" IS NOT NULL;
""");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PlayerTeamRegistrations",
schema: "Club12");
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,85 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddSlugToBlogPost : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "BlogPosts",
type: "character varying(220)",
maxLength: 220,
nullable: true);
// Backfills every existing post's Slug from its current Title, mirroring
// SlugGenerator.GenerateSlug (lowercase, accented characters
// transliterated to their base letter, non-alphanumeric runs collapsed
// to a single hyphen, leading/trailing hyphens trimmed). Rows whose
// computed base slug collides get a numeric suffix (-2, -3, ...)
// ordered by Id, the same disambiguation strategy SlugGenerator uses
// for newly created rows.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Title""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""BlogPosts""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""BlogPosts"" bp
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE bp.""Id"" = n.""Id"";
"
);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "BlogPosts",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_BlogPosts_Slug",
schema: "Club12",
table: "BlogPosts",
column: "Slug",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_BlogPosts_Slug",
schema: "Club12",
table: "BlogPosts");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "BlogPosts");
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,101 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddSlugToPlayerSanction : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "PlayerSanctions",
type: "character varying(220)",
maxLength: 220,
nullable: true);
// Backfills every existing sanction's Slug from its sanctioned player's
// name and the sanction's issued date, mirroring PlayerSanctionService's
// "{playerFullName} {issuedDate:yyyy-MM-dd}" source string fed through
// SlugGenerator.GenerateSlug (lowercase, accented characters
// transliterated to their base letter, non-alphanumeric runs collapsed
// to a single hyphen, leading/trailing hyphens trimmed). The player's
// last/first/second name are concatenated the same way as the
// application's Player.FullName computed property (case does not
// matter here since the whole string is lowercased regardless). Rows
// whose computed base slug collides (e.g. the same player sanctioned
// twice on the same day) get a numeric suffix (-2, -3, ...) ordered by
// Id, the same disambiguation strategy SlugGenerator uses for newly
// created rows.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ps.""Id"",
trim(both '-' from
regexp_replace(
translate(
lower(
concat(
p.""LastName"", ' ', p.""FirstName"",
CASE WHEN p.""SecondName"" IS NULL OR trim(p.""SecondName"") = '' THEN '' ELSE ' ' || p.""SecondName"" END,
' ', to_char(ps.""IssuedDate"", 'YYYY-MM-DD')
)
),
'áéíóúüñ', 'aeiouun'
),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""PlayerSanctions"" ps
JOIN ""Club12"".""Players"" p ON p.""Id"" = ps.""PlayerId""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""PlayerSanctions"" ps
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE ps.""Id"" = n.""Id"";
"
);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "PlayerSanctions",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_PlayerSanctions_Slug",
schema: "Club12",
table: "PlayerSanctions",
column: "Slug",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_PlayerSanctions_Slug",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "PlayerSanctions");
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations;
/// <inheritdoc />
public partial class AddBackupRecordTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BackupRecords",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
StoragePath = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
SizeBytes = table.Column<long>(type: "bigint", nullable: false),
Origin = table.Column<string>(type: "text", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BackupRecords", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_BackupRecord_CreatedAt",
schema: "Club12",
table: "BackupRecords",
column: "DateCreated");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BackupRecords",
schema: "Club12");
}
}
@@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTeamTournamentRegistrationTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TeamTournamentRegistrations",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
TournamentId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TeamTournamentRegistrations", x => x.Id);
table.ForeignKey(
name: "FK_TeamTournamentRegistrations_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TeamTournamentRegistrations_Tournaments_TournamentId",
column: x => x.TournamentId,
principalSchema: "Club12",
principalTable: "Tournaments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_TeamTournamentRegistration_CreatedAt",
schema: "Club12",
table: "TeamTournamentRegistrations",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_TeamTournamentRegistrations_TeamId_TournamentId",
schema: "Club12",
table: "TeamTournamentRegistrations",
columns: new[] { "TeamId", "TournamentId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_TeamTournamentRegistrations_TournamentId",
schema: "Club12",
table: "TeamTournamentRegistrations",
column: "TournamentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TeamTournamentRegistrations",
schema: "Club12");
}
}
}
@@ -0,0 +1,286 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddSlugToDivisionStageVenuePlayer : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Divisions",
type: "character varying(220)",
maxLength: 220,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Stages",
type: "character varying(220)",
maxLength: 220,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Venues",
type: "character varying(220)",
maxLength: 220,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Slug",
schema: "Club12",
table: "Players",
type: "character varying(220)",
maxLength: 220,
nullable: true);
// Backfills every existing Division/Stage/Venue row's Slug from its
// current Name, mirroring SlugGenerator.GenerateSlug (lowercase,
// accented characters transliterated to their base letter,
// non-alphanumeric runs collapsed to a single hyphen,
// leading/trailing hyphens trimmed). Rows whose computed base slug
// collides get a numeric suffix (-2, -3, ...) ordered by Id, the
// same disambiguation strategy SlugGenerator uses for newly created
// rows.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Divisions""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Divisions"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Stages""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Stages"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Venues""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Venues"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
// Backfills every existing player's Slug from their full name,
// mirroring PlayerService's use of Player.FullName fed through
// SlugGenerator.GenerateSlug. The last/first/second name are
// concatenated the same way as the application's Player.FullName
// computed property (case does not matter here since the whole
// string is lowercased regardless). Duplicate names get a numeric
// suffix (-2, -3, ...) ordered by Id, matching SlugGenerator's
// disambiguation for newly created rows.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(
lower(
concat(
""LastName"", ' ', ""FirstName"",
CASE WHEN ""SecondName"" IS NULL OR trim(""SecondName"") = '' THEN '' ELSE ' ' || ""SecondName"" END
)
),
'áéíóúüñ', 'aeiouun'
),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Players""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Players"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Divisions",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Stages",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Venues",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Slug",
schema: "Club12",
table: "Players",
type: "character varying(220)",
maxLength: 220,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(220)",
oldMaxLength: 220,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_Divisions_Slug",
schema: "Club12",
table: "Divisions",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Stages_Slug",
schema: "Club12",
table: "Stages",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Venues_Slug",
schema: "Club12",
table: "Venues",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Players_Slug",
schema: "Club12",
table: "Players",
column: "Slug",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Venues_Slug",
schema: "Club12",
table: "Venues");
migrationBuilder.DropIndex(
name: "IX_Stages_Slug",
schema: "Club12",
table: "Stages");
migrationBuilder.DropIndex(
name: "IX_Players_Slug",
schema: "Club12",
table: "Players");
migrationBuilder.DropIndex(
name: "IX_Divisions_Slug",
schema: "Club12",
table: "Divisions");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Venues");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Stages");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Players");
migrationBuilder.DropColumn(
name: "Slug",
schema: "Club12",
table: "Divisions");
}
}
}
@@ -0,0 +1,66 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class DropTournamentTeamCountLimits : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// HU-34: MinTeams / MaxTeams are no longer part of the tournament model.
migrationBuilder.DropColumn(
name: "MaxTeams",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "MinTeams",
schema: "Club12",
table: "Tournaments");
// HU-35: the new RegistrationClosed status is inserted BETWEEN
// OpenForRegistration (1) and Ongoing in the TournamentStatus enum,
// which is persisted as its integer ordinal. Inserting a value in
// the middle shifts every following member up by one, so existing
// rows must be remapped: Ongoing 2->3, Finished 3->4, Canceled 4->5.
// Updated in descending order so an already-shifted value is never
// re-matched by a later statement. Scheduled (0) and
// OpenForRegistration (1) are unchanged; no existing row can hold
// the newly freed value 2 (RegistrationClosed).
migrationBuilder.Sql(@"UPDATE ""Club12"".""Tournaments"" SET ""Status"" = 5 WHERE ""Status"" = 4;");
migrationBuilder.Sql(@"UPDATE ""Club12"".""Tournaments"" SET ""Status"" = 4 WHERE ""Status"" = 3;");
migrationBuilder.Sql(@"UPDATE ""Club12"".""Tournaments"" SET ""Status"" = 3 WHERE ""Status"" = 2;");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// Reverse the status remap (ascending, mirror of Up): Canceled
// 5->4, Finished 4->3, Ongoing 3->2. Any row left on 2 after this
// (a RegistrationClosed tournament) collapses back onto Ongoing (2),
// the closest pre-RegistrationClosed state.
migrationBuilder.Sql(@"UPDATE ""Club12"".""Tournaments"" SET ""Status"" = 2 WHERE ""Status"" = 3;");
migrationBuilder.Sql(@"UPDATE ""Club12"".""Tournaments"" SET ""Status"" = 3 WHERE ""Status"" = 4;");
migrationBuilder.Sql(@"UPDATE ""Club12"".""Tournaments"" SET ""Status"" = 4 WHERE ""Status"" = 5;");
migrationBuilder.AddColumn<int>(
name: "MaxTeams",
schema: "Club12",
table: "Tournaments",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "MinTeams",
schema: "Club12",
table: "Tournaments",
type: "integer",
nullable: false,
defaultValue: 0);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddMatchStatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// HU-69: new result-lifecycle column. New rows default to
// "Scheduled"; the column is persisted as the enum name (string).
migrationBuilder.AddColumn<string>(
name: "Status",
schema: "Club12",
table: "Matches",
type: "text",
nullable: false,
defaultValue: "Scheduled");
// Backfill existing rows: any already-finished match is a normally
// played result (walkovers did not exist before this column).
migrationBuilder.Sql(
@"UPDATE ""Club12"".""Matches"" SET ""Status"" = 'Played' WHERE ""IsFinished"" = true;");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Status",
schema: "Club12",
table: "Matches");
}
}
}
@@ -0,0 +1,88 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddDivisionPointsAndPlayoffMapping : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "PointsForLoss",
schema: "Club12",
table: "Divisions",
type: "integer",
nullable: false,
defaultValue: 1);
migrationBuilder.AddColumn<int>(
name: "PointsForWin",
schema: "Club12",
table: "Divisions",
type: "integer",
nullable: false,
defaultValue: 2);
migrationBuilder.CreateTable(
name: "DivisionPlayoffMappings",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DivisionId = table.Column<Guid>(type: "uuid", nullable: false),
FromPosition = table.Column<int>(type: "integer", nullable: false),
ToPosition = table.Column<int>(type: "integer", nullable: false),
Destination = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DivisionPlayoffMappings", x => x.Id);
table.ForeignKey(
name: "FK_DivisionPlayoffMappings_Divisions_DivisionId",
column: x => x.DivisionId,
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DivisionPlayoffMapping_CreatedAt",
schema: "Club12",
table: "DivisionPlayoffMappings",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_DivisionPlayoffMappings_DivisionId",
schema: "Club12",
table: "DivisionPlayoffMappings",
column: "DivisionId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DivisionPlayoffMappings",
schema: "Club12");
migrationBuilder.DropColumn(
name: "PointsForLoss",
schema: "Club12",
table: "Divisions");
migrationBuilder.DropColumn(
name: "PointsForWin",
schema: "Club12",
table: "Divisions");
}
}
}
@@ -0,0 +1,88 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace Infrastructure.Migrations;
/// <summary>
/// Adds the medical-record / eligibility fields to PlayerTeamRegistration
/// (HU-55/57/58/59). Because the record lives on the season registration, it is
/// inherently per season: every existing row starts (and every new row
/// defaults to) 'Pending', so no prior approval is ever inherited (HU-59).
/// </summary>
public partial class AddMedicalRecordToPlayerTeamRegistration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// Status persisted as the enum name (string), mirroring the other enum
// columns in this DB. Existing rows default to 'Pending' — no season
// ever inherits another season's approval (HU-59).
migrationBuilder.AddColumn<string>(
name: "MedicalRecordStatus",
schema: "Club12",
table: "PlayerTeamRegistrations",
type: "text",
nullable: false,
defaultValue: "Pending");
migrationBuilder.AddColumn<string>(
name: "MedicalRecordFileUrl",
schema: "Club12",
table: "PlayerTeamRegistrations",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "MedicalRecordFileName",
schema: "Club12",
table: "PlayerTeamRegistrations",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "MedicalRecordReviewReason",
schema: "Club12",
table: "PlayerTeamRegistrations",
type: "text",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "MedicalRecordReviewedAt",
schema: "Club12",
table: "PlayerTeamRegistrations",
type: "timestamp without time zone",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MedicalRecordStatus",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.DropColumn(
name: "MedicalRecordFileUrl",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.DropColumn(
name: "MedicalRecordFileName",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.DropColumn(
name: "MedicalRecordReviewReason",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.DropColumn(
name: "MedicalRecordReviewedAt",
schema: "Club12",
table: "PlayerTeamRegistrations");
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddRoundToMatch : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// HU-63/HU-65: the matchday (jornada) a match belongs to, 1-based.
// Nullable: existing rows and non-round-robin matches (e.g. knockout
// stages) have no round. New round-robin fixtures set it explicitly.
migrationBuilder.AddColumn<int>(
name: "Round",
schema: "Club12",
table: "Matches",
type: "integer",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Round",
schema: "Club12",
table: "Matches");
}
}
}
@@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTournamentAndDivisionCategory : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Category",
schema: "Club12",
table: "Tournaments",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Category",
schema: "Club12",
table: "Divisions",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Category",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "Category",
schema: "Club12",
table: "Divisions");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,111 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddSubjectToPlayerSanction : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// HU-77: a sanction subject can now be a player, a team or a staff
// member. Existing rows are all player sanctions, so SubjectType
// defaults to 'Player' and PlayerId keeps its value.
// Drop the NOT NULL constraint on PlayerId: team/staff sanctions
// have no player.
migrationBuilder.AlterColumn<System.Guid>(
name: "PlayerId",
schema: "Club12",
table: "PlayerSanctions",
type: "uuid",
nullable: true,
oldClrType: typeof(System.Guid),
oldType: "uuid");
migrationBuilder.AddColumn<string>(
name: "SubjectType",
schema: "Club12",
table: "PlayerSanctions",
type: "text",
nullable: false,
defaultValue: "Player");
migrationBuilder.AddColumn<System.Guid>(
name: "TeamId",
schema: "Club12",
table: "PlayerSanctions",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "StaffName",
schema: "Club12",
table: "PlayerSanctions",
type: "character varying(255)",
maxLength: 255,
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_PlayerSanctions_TeamId",
schema: "Club12",
table: "PlayerSanctions",
column: "TeamId");
migrationBuilder.AddForeignKey(
name: "FK_PlayerSanctions_Teams_TeamId",
schema: "Club12",
table: "PlayerSanctions",
column: "TeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlayerSanctions_Teams_TeamId",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropIndex(
name: "IX_PlayerSanctions_TeamId",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "SubjectType",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "TeamId",
schema: "Club12",
table: "PlayerSanctions");
migrationBuilder.DropColumn(
name: "StaffName",
schema: "Club12",
table: "PlayerSanctions");
// Restore NOT NULL on PlayerId. Any team/staff sanctions must be
// removed before rolling back, otherwise this will fail on their
// null PlayerId (intentional: they cannot be represented downlevel).
migrationBuilder.AlterColumn<System.Guid>(
name: "PlayerId",
schema: "Club12",
table: "PlayerSanctions",
type: "uuid",
nullable: false,
defaultValue: System.Guid.Empty,
oldClrType: typeof(System.Guid),
oldType: "uuid",
oldNullable: true);
}
}
}
@@ -0,0 +1,122 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <summary>
/// Additive schema for three stories:
/// - HU-101: the AuditLogs table (sensitive-action trail).
/// - HU-16: BlogPosts.IsPublished (draft/published; defaults true so
/// existing posts stay publicly visible).
/// - HU-54: PlayerTeamRegistrations.JerseyNumber (dorsal) plus the unique
/// (TeamId, TournamentId, JerseyNumber) index enforcing unique dorsals
/// within a team+season. The pre-existing standalone TeamId index is
/// dropped because the new composite index covers it as a prefix.
///
/// The HU-77 PlayerSanctions changes (SubjectType/StaffName/TeamId, nullable
/// PlayerId, the Team FK and its index) are intentionally NOT repeated here:
/// they were already applied to the database by the hand-authored
/// 20260828040000_AddSubjectToPlayerSanction migration. This migration only
/// carries the delta the model snapshot had not yet captured for the three
/// stories above, so the migration history and the model snapshot converge
/// without re-adding columns that already exist.
/// </summary>
/// <inheritdoc />
public partial class AddAuditLogBlogPublishAndJerseyNumber : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_PlayerTeamRegistrations_TeamId",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.AddColumn<int>(
name: "JerseyNumber",
schema: "Club12",
table: "PlayerTeamRegistrations",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsPublished",
schema: "Club12",
table: "BlogPosts",
type: "boolean",
nullable: false,
defaultValue: true);
migrationBuilder.CreateTable(
name: "AuditLogs",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Action = table.Column<string>(type: "text", nullable: false),
Actor = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
TargetType = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
TargetId = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
Detail = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AuditLogs", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PlayerTeamRegistrations_TeamId_TournamentId_JerseyNumber",
schema: "Club12",
table: "PlayerTeamRegistrations",
columns: new[] { "TeamId", "TournamentId", "JerseyNumber" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AuditLog_CreatedAt",
schema: "Club12",
table: "AuditLogs",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_AuditLogs_Action",
schema: "Club12",
table: "AuditLogs",
column: "Action");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AuditLogs",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_PlayerTeamRegistrations_TeamId_TournamentId_JerseyNumber",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.DropColumn(
name: "JerseyNumber",
schema: "Club12",
table: "PlayerTeamRegistrations");
migrationBuilder.DropColumn(
name: "IsPublished",
schema: "Club12",
table: "BlogPosts");
migrationBuilder.CreateIndex(
name: "IX_PlayerTeamRegistrations_TeamId",
schema: "Club12",
table: "PlayerTeamRegistrations",
column: "TeamId");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,93 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddClubEntity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "ClubId",
schema: "Club12",
table: "Teams",
type: "uuid",
nullable: true);
migrationBuilder.CreateTable(
name: "Clubs",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Slug = table.Column<string>(type: "character varying(220)", maxLength: 220, nullable: false),
LogoUrl = table.Column<string>(type: "text", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Clubs", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Teams_ClubId",
schema: "Club12",
table: "Teams",
column: "ClubId");
migrationBuilder.CreateIndex(
name: "IX_Club_CreatedAt",
schema: "Club12",
table: "Clubs",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Clubs_Slug",
schema: "Club12",
table: "Clubs",
column: "Slug",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Teams_Clubs_ClubId",
schema: "Club12",
table: "Teams",
column: "ClubId",
principalSchema: "Club12",
principalTable: "Clubs",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Clubs_ClubId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropTable(
name: "Clubs",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_Teams_ClubId",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "ClubId",
schema: "Club12",
table: "Teams");
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddQualifiersPerGroupToDivision : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "QualifiersPerGroup",
schema: "Club12",
table: "Divisions",
type: "integer",
nullable: false,
defaultValue: 1);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "QualifiersPerGroup",
schema: "Club12",
table: "Divisions");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTeamJerseyKit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "JerseyStyle",
schema: "Club12",
table: "Teams",
type: "character varying(20)",
maxLength: 20,
nullable: false,
defaultValue: "solid");
migrationBuilder.AddColumn<string>(
name: "ShirtSecondaryColor",
schema: "Club12",
table: "Teams",
type: "character varying(9)",
maxLength: 9,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "JerseyStyle",
schema: "Club12",
table: "Teams");
migrationBuilder.DropColumn(
name: "ShirtSecondaryColor",
schema: "Club12",
table: "Teams");
}
}
}
@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class RebackfillDivisionStageSlugs : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// Re-backfills every Division/Stage Slug from its current Name,
// overwriting the GUID-polluted slugs that the sample seeder used to
// produce (e.g. "primera-division-34ce6485-...") with a clean
// kebab-case slug (e.g. "primera-division"). Mirrors
// SlugGenerator.GenerateSlug exactly: lowercase, Spanish accents
// transliterated to their base letter, non-alphanumeric runs
// collapsed to a single hyphen, leading/trailing hyphens trimmed.
// Rows whose computed base slug collides get a numeric suffix
// (-2, -3, ...) ordered by Id — the same disambiguation strategy the
// application and the original 20260828003816 backfill use, so the
// Slug unique index is preserved.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Divisions""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Divisions"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
migrationBuilder.Sql(
@"
WITH base AS (
SELECT ""Id"",
trim(both '-' from
regexp_replace(
translate(lower(""Name""), 'áéíóúüñ', 'aeiouun'),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Stages""
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Stages"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// Data-only re-backfill: there is no meaningful inverse (the original
// GUID-suffixed slugs are not recoverable). Down is intentionally a
// no-op so the migration can still be rolled back structurally.
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,93 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddSeason : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "SeasonId",
schema: "Club12",
table: "Tournaments",
type: "uuid",
nullable: true);
migrationBuilder.CreateTable(
name: "Seasons",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Slug = table.Column<string>(type: "character varying(220)", maxLength: 220, nullable: false),
Year = table.Column<int>(type: "integer", nullable: true),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Seasons", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Tournaments_SeasonId",
schema: "Club12",
table: "Tournaments",
column: "SeasonId");
migrationBuilder.CreateIndex(
name: "IX_Season_CreatedAt",
schema: "Club12",
table: "Seasons",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_Seasons_Slug",
schema: "Club12",
table: "Seasons",
column: "Slug",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Tournaments_Seasons_SeasonId",
schema: "Club12",
table: "Tournaments",
column: "SeasonId",
principalSchema: "Club12",
principalTable: "Seasons",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Tournaments_Seasons_SeasonId",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropTable(
name: "Seasons",
schema: "Club12");
migrationBuilder.DropIndex(
name: "IX_Tournaments_SeasonId",
schema: "Club12",
table: "Tournaments");
migrationBuilder.DropColumn(
name: "SeasonId",
schema: "Club12",
table: "Tournaments");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTeamPointDeduction : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TeamPointDeductions",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DivisionId = table.Column<Guid>(type: "uuid", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
Points = table.Column<int>(type: "integer", nullable: false),
Reason = table.Column<string>(type: "character varying(300)", maxLength: 300, nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TeamPointDeductions", x => x.Id);
table.ForeignKey(
name: "FK_TeamPointDeductions_Divisions_DivisionId",
column: x => x.DivisionId,
principalSchema: "Club12",
principalTable: "Divisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TeamPointDeductions_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_TeamPointDeduction_CreatedAt",
schema: "Club12",
table: "TeamPointDeductions",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_TeamPointDeductions_DivisionId",
schema: "Club12",
table: "TeamPointDeductions",
column: "DivisionId");
migrationBuilder.CreateIndex(
name: "IX_TeamPointDeductions_TeamId",
schema: "Club12",
table: "TeamPointDeductions",
column: "TeamId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TeamPointDeductions",
schema: "Club12");
}
}
}
@@ -0,0 +1,118 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class RebackfillPlayerSlugsWithoutDocumentNumber : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// Re-backfills every Player.Slug to the single canonical format
// "apellido-nombre[-segundo]" (Player.BuildSlugSource fed through
// SlugGenerator.GenerateSlug) — dropping the DocumentNumber segment
// that the old sample seeder used to append. Mirrors the shipped
// 20260828003816 player backfill verbatim (same concat, same
// translate/regexp_replace, same ROW_NUMBER() ... ORDER BY "Id"
// suffix rule) so create, seed and backfill share one rule.
//
// Reversible via a snapshot ledger: pre-migration slugs are an
// unrecoverable mixture of "apellido-nombre-dni" (seed) and
// "apellido-nombre[-N]" (create/backfill), so the only correct
// inverse is to store and restore them. The ledger table lives
// outside the EF model, so the model differ ignores it.
// 1. Rollback ledger — drop+recreate (idempotent under a Down->Up
// cycle) and snapshot the current slugs.
migrationBuilder.Sql(
@"
DROP TABLE IF EXISTS ""Club12"".""PlayerSlugBackup_20260829"";
CREATE TABLE ""Club12"".""PlayerSlugBackup_20260829"" (
""Id"" uuid PRIMARY KEY,
""OldSlug"" character varying(220) NOT NULL
);
INSERT INTO ""Club12"".""PlayerSlugBackup_20260829"" (""Id"", ""OldSlug"")
SELECT ""Id"", ""Slug"" FROM ""Club12"".""Players"";
"
);
// 2. Park every slug on a value SlugGenerator's [^a-z0-9]+ rule can
// never emit ('_' is disjoint from every real and every final
// slug), so the two-phase reassignment below never trips the
// plain (non-deferrable) IX_Players_Slug unique index mid-update.
migrationBuilder.Sql(
@"
UPDATE ""Club12"".""Players"" SET ""Slug"" = '__tmp_' || ""Id""::text;
"
);
// 3. Assign canonical slugs. Targets are distinct by construction
// (ROW_NUMBER suffix) and disjoint from '__tmp_%'.
migrationBuilder.Sql(
@"
WITH base AS (
SELECT p.""Id"",
trim(both '-' from
regexp_replace(
translate(
lower(
concat(
p.""LastName"", ' ', p.""FirstName"",
CASE WHEN p.""SecondName"" IS NULL OR trim(p.""SecondName"") = '' THEN '' ELSE ' ' || p.""SecondName"" END
)
),
'áéíóúüñ', 'aeiouun'
),
'[^a-z0-9]+', '-', 'g'
)
) AS slug_base
FROM ""Club12"".""Players"" p
),
numbered AS (
SELECT ""Id"", slug_base,
ROW_NUMBER() OVER (PARTITION BY slug_base ORDER BY ""Id"") AS rn
FROM base
)
UPDATE ""Club12"".""Players"" t
SET ""Slug"" = CASE WHEN n.rn = 1 THEN n.slug_base ELSE n.slug_base || '-' || n.rn::text END
FROM numbered n
WHERE t.""Id"" = n.""Id"";
"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// True inverse, guarded so it never half-restores. Re-park first for
// the same index-permutation reason as Up. Players inserted AFTER Up
// have no ledger row and keep their canonical slug — correct, since
// no prior value exists to restore. Double-Down is a safe no-op.
migrationBuilder.Sql(
@"
UPDATE ""Club12"".""Players"" SET ""Slug"" = '__tmp_' || ""Id""::text
WHERE to_regclass('""Club12"".""PlayerSlugBackup_20260829""') IS NOT NULL;
"
);
migrationBuilder.Sql(
@"
UPDATE ""Club12"".""Players"" t
SET ""Slug"" = b.""OldSlug""
FROM ""Club12"".""PlayerSlugBackup_20260829"" b
WHERE t.""Id"" = b.""Id"";
"
);
migrationBuilder.Sql(
@"
DROP TABLE IF EXISTS ""Club12"".""PlayerSlugBackup_20260829"";
"
);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddVenueImageAndLocation : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "Latitude",
schema: "Club12",
table: "Venues",
type: "double precision",
nullable: true);
migrationBuilder.AddColumn<double>(
name: "Longitude",
schema: "Club12",
table: "Venues",
type: "double precision",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Latitude",
schema: "Club12",
table: "Venues");
migrationBuilder.DropColumn(
name: "Longitude",
schema: "Club12",
table: "Venues");
}
}
}
@@ -0,0 +1,107 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class HardenMatchSeriesTeamOnDelete : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MatchSeries_Teams_HomeTeamId",
schema: "Club12",
table: "MatchSeries");
migrationBuilder.DropForeignKey(
name: "FK_MatchSeries_Teams_VisitorTeamId",
schema: "Club12",
table: "MatchSeries");
migrationBuilder.DropForeignKey(
name: "FK_MatchSeries_Teams_WinningTeamId",
schema: "Club12",
table: "MatchSeries");
migrationBuilder.AddForeignKey(
name: "FK_MatchSeries_Teams_HomeTeamId",
schema: "Club12",
table: "MatchSeries",
column: "HomeTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_MatchSeries_Teams_VisitorTeamId",
schema: "Club12",
table: "MatchSeries",
column: "VisitorTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_MatchSeries_Teams_WinningTeamId",
schema: "Club12",
table: "MatchSeries",
column: "WinningTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MatchSeries_Teams_HomeTeamId",
schema: "Club12",
table: "MatchSeries");
migrationBuilder.DropForeignKey(
name: "FK_MatchSeries_Teams_VisitorTeamId",
schema: "Club12",
table: "MatchSeries");
migrationBuilder.DropForeignKey(
name: "FK_MatchSeries_Teams_WinningTeamId",
schema: "Club12",
table: "MatchSeries");
migrationBuilder.AddForeignKey(
name: "FK_MatchSeries_Teams_HomeTeamId",
schema: "Club12",
table: "MatchSeries",
column: "HomeTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MatchSeries_Teams_VisitorTeamId",
schema: "Club12",
table: "MatchSeries",
column: "VisitorTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MatchSeries_Teams_WinningTeamId",
schema: "Club12",
table: "MatchSeries",
column: "WinningTeamId",
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTeamStaffTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TeamStaffs",
schema: "Club12",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TeamId = table.Column<Guid>(type: "uuid", nullable: false),
TournamentId = table.Column<Guid>(type: "uuid", nullable: false),
FullName = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: false),
Role = table.Column<int>(type: "integer", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TeamStaffs", x => x.Id);
table.ForeignKey(
name: "FK_TeamStaffs_Teams_TeamId",
column: x => x.TeamId,
principalSchema: "Club12",
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TeamStaffs_Tournaments_TournamentId",
column: x => x.TournamentId,
principalSchema: "Club12",
principalTable: "Tournaments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_TeamStaff_CreatedAt",
schema: "Club12",
table: "TeamStaffs",
column: "DateCreated");
migrationBuilder.CreateIndex(
name: "IX_TeamStaffs_TeamId_TournamentId",
schema: "Club12",
table: "TeamStaffs",
columns: new[] { "TeamId", "TournamentId" });
migrationBuilder.CreateIndex(
name: "IX_TeamStaffs_TournamentId",
schema: "Club12",
table: "TeamStaffs",
column: "TournamentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TeamStaffs",
schema: "Club12");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,71 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class CleanupOrphanedTournaments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// Data-only cleanup: before this fix (see SeasonService.DeleteSeasonAsync),
// deleting a Season only detached its tournaments (SetNull, not
// Cascade) instead of deleting them, leaving "orphaned" tournaments
// behind — SeasonId is null, but the tournament (and its
// TeamTournamentRegistrations, blocking those teams' own deletion)
// is still alive and invisible from any season-scoped screen.
//
// This mirrors TournamentService.DeleteTournamentAsync exactly: the
// same "safe to delete" guard (not started — Status not in
// Ongoing/Finished — and no played match), AND the same pre-step of
// clearing every enrolled team's denormalized Team.TournamentId
// "current-season" pointer first. That FK (Team -> Tournament) is
// NoAction by design, so a still-set pointer aborts the delete with
// an opaque FK error (FK_Teams_Tournaments_TournamentId) — which is
// exactly what the first cut of this migration hit. Team identities
// survive; their TeamTournamentRegistration rows, plus the
// tournament's Divisions/Stages/Matches, cascade away via their
// existing FK configuration. An orphaned tournament that already has
// real history is never touched and is left for an admin to handle.
migrationBuilder.Sql(
"""
DO $$
BEGIN
IF EXISTS (
SELECT 1 FROM information_schema.tables
WHERE table_schema = 'Club12' AND table_name = 'Tournaments'
) THEN
CREATE TEMPORARY TABLE _orphaned_tournaments ON COMMIT DROP AS
SELECT t."Id"
FROM "Club12"."Tournaments" t
WHERE t."SeasonId" IS NULL
AND t."Status" NOT IN (3, 4) -- Ongoing, Finished
AND NOT EXISTS (
SELECT 1
FROM "Club12"."Matches" m
JOIN "Club12"."Stages" s ON s."Id" = m."StageId"
JOIN "Club12"."Divisions" d ON d."Id" = s."DivisionId"
WHERE d."TournamentId" = t."Id" AND m."IsFinished" = TRUE
);
UPDATE "Club12"."Teams"
SET "TournamentId" = NULL
WHERE "TournamentId" IN (SELECT "Id" FROM _orphaned_tournaments);
DELETE FROM "Club12"."Tournaments"
WHERE "Id" IN (SELECT "Id" FROM _orphaned_tournaments);
END IF;
END $$;
""");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// Irreversible: the whole point is deleting rows that never should
// have survived their season's deletion. Nothing to restore.
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTargetNameToAuditLog : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "TargetName",
schema: "Club12",
table: "AuditLogs",
type: "character varying(256)",
maxLength: 256,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TargetName",
schema: "Club12",
table: "AuditLogs");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddWentToOvertimeToMatch : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "WentToOvertime",
schema: "Club12",
table: "Matches",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WentToOvertime",
schema: "Club12",
table: "Matches");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTeamShirtTertiaryColor : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ShirtTertiaryColor",
schema: "Club12",
table: "Teams",
type: "character varying(9)",
maxLength: 9,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ShirtTertiaryColor",
schema: "Club12",
table: "Teams");
}
}
}

Some files were not shown because too many files have changed in this diff Show More