Implement traits system (#10693)

This commit is contained in:
Visne
2022-09-10 17:40:06 +02:00
committed by GitHub
parent e1782ec22b
commit 4cc5fa239e
17 changed files with 3006 additions and 29 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Content.Server.Database.Migrations.Postgres
{
public partial class Traits : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "trait",
columns: table => new
{
trait_id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
profile_id = table.Column<int>(type: "integer", nullable: false),
trait_name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_trait", x => x.trait_id);
table.ForeignKey(
name: "FK_trait_profile_profile_id",
column: x => x.profile_id,
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_trait_profile_id",
table: "trait",
column: "profile_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "trait");
}
}
}

View File

@@ -914,6 +914,33 @@ namespace Content.Server.Database.Migrations.Postgres
b.ToTable("server_unban", (string)null);
});
modelBuilder.Entity("Content.Server.Database.Trait", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("trait_id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ProfileId")
.HasColumnType("integer")
.HasColumnName("profile_id");
b.Property<string>("TraitName")
.IsRequired()
.HasColumnType("text")
.HasColumnName("trait_name");
b.HasKey("Id")
.HasName("PK_trait");
b.HasIndex("ProfileId")
.HasDatabaseName("IX_trait_profile_id");
b.ToTable("trait", (string)null);
});
modelBuilder.Entity("Content.Server.Database.UploadedResourceLog", b =>
{
b.Property<int>("Id")
@@ -1197,6 +1224,18 @@ namespace Content.Server.Database.Migrations.Postgres
b.Navigation("Ban");
});
modelBuilder.Entity("Content.Server.Database.Trait", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Traits")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_trait_profile_profile_id");
b.Navigation("Profile");
});
modelBuilder.Entity("PlayerRound", b =>
{
b.HasOne("Content.Server.Database.Player", null)
@@ -1261,6 +1300,8 @@ namespace Content.Server.Database.Migrations.Postgres
b.Navigation("Antags");
b.Navigation("Jobs");
b.Navigation("Traits");
});
modelBuilder.Entity("Content.Server.Database.Round", b =>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class Traits : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "trait",
columns: table => new
{
trait_id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
profile_id = table.Column<int>(type: "INTEGER", nullable: false),
trait_name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_trait", x => x.trait_id);
table.ForeignKey(
name: "FK_trait_profile_profile_id",
column: x => x.profile_id,
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_trait_profile_id",
table: "trait",
column: "profile_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "trait");
}
}
}

View File

@@ -852,6 +852,31 @@ namespace Content.Server.Database.Migrations.Sqlite
b.ToTable("server_unban", (string)null);
});
modelBuilder.Entity("Content.Server.Database.Trait", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasColumnName("trait_id");
b.Property<int>("ProfileId")
.HasColumnType("INTEGER")
.HasColumnName("profile_id");
b.Property<string>("TraitName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("trait_name");
b.HasKey("Id")
.HasName("PK_trait");
b.HasIndex("ProfileId")
.HasDatabaseName("IX_trait_profile_id");
b.ToTable("trait", (string)null);
});
modelBuilder.Entity("Content.Server.Database.UploadedResourceLog", b =>
{
b.Property<int>("Id")
@@ -1133,6 +1158,18 @@ namespace Content.Server.Database.Migrations.Sqlite
b.Navigation("Ban");
});
modelBuilder.Entity("Content.Server.Database.Trait", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Traits")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_trait_profile_profile_id");
b.Navigation("Profile");
});
modelBuilder.Entity("PlayerRound", b =>
{
b.HasOne("Content.Server.Database.Player", null)
@@ -1197,6 +1234,8 @@ namespace Content.Server.Database.Migrations.Sqlite
b.Navigation("Antags");
b.Navigation("Jobs");
b.Navigation("Traits");
});
modelBuilder.Entity("Content.Server.Database.Round", b =>