- add: database for genitals
This commit is contained in:
1862
Content.Server.Database/Migrations/Postgres/20240216194701_Genital.Designer.cs
generated
Normal file
1862
Content.Server.Database/Migrations/Postgres/20240216194701_Genital.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Postgres
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Genital : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "genital",
|
||||
columns: table => new
|
||||
{
|
||||
genital_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
profile_id = table.Column<int>(type: "integer", nullable: false),
|
||||
genital_prototype = table.Column<string>(type: "text", nullable: false),
|
||||
color = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_genital", x => x.genital_id);
|
||||
table.ForeignKey(
|
||||
name: "FK_genital_profile_profile_id",
|
||||
column: x => x.profile_id,
|
||||
principalTable: "profile",
|
||||
principalColumn: "profile_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_genital_profile_id_genital_prototype",
|
||||
table: "genital",
|
||||
columns: new[] { "profile_id", "genital_prototype" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "genital");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -564,6 +564,38 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Genital", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("genital_id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("color");
|
||||
|
||||
b.Property<string>("GenitalPrototype")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("genital_prototype");
|
||||
|
||||
b.Property<int>("ProfileId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("profile_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK_genital");
|
||||
|
||||
b.HasIndex("ProfileId", "GenitalPrototype")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("genital", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Job", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1545,6 +1577,18 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
b.Navigation("Server");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Genital", b =>
|
||||
{
|
||||
b.HasOne("Content.Server.Database.Profile", "Profile")
|
||||
.WithMany("Genitals")
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK_genital_profile_profile_id");
|
||||
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Job", b =>
|
||||
{
|
||||
b.HasOne("Content.Server.Database.Profile", "Profile")
|
||||
@@ -1779,6 +1823,8 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
{
|
||||
b.Navigation("Antags");
|
||||
|
||||
b.Navigation("Genitals");
|
||||
|
||||
b.Navigation("Jobs");
|
||||
|
||||
b.Navigation("Traits");
|
||||
|
||||
1789
Content.Server.Database/Migrations/Sqlite/20240216194646_Genital.Designer.cs
generated
Normal file
1789
Content.Server.Database/Migrations/Sqlite/20240216194646_Genital.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Genital : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "genital",
|
||||
columns: table => new
|
||||
{
|
||||
genital_id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
profile_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
genital_prototype = table.Column<string>(type: "TEXT", nullable: false),
|
||||
color = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_genital", x => x.genital_id);
|
||||
table.ForeignKey(
|
||||
name: "FK_genital_profile_profile_id",
|
||||
column: x => x.profile_id,
|
||||
principalTable: "profile",
|
||||
principalColumn: "profile_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_genital_profile_id_genital_prototype",
|
||||
table: "genital",
|
||||
columns: new[] { "profile_id", "genital_prototype" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "genital");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -530,6 +530,36 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
b.ToTable("connection_log", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Genital", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("genital_id");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("color");
|
||||
|
||||
b.Property<string>("GenitalPrototype")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("genital_prototype");
|
||||
|
||||
b.Property<int>("ProfileId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("profile_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK_genital");
|
||||
|
||||
b.HasIndex("ProfileId", "GenitalPrototype")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("genital", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Job", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1474,6 +1504,18 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
b.Navigation("Server");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Genital", b =>
|
||||
{
|
||||
b.HasOne("Content.Server.Database.Profile", "Profile")
|
||||
.WithMany("Genitals")
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK_genital_profile_profile_id");
|
||||
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Job", b =>
|
||||
{
|
||||
b.HasOne("Content.Server.Database.Profile", "Profile")
|
||||
@@ -1708,6 +1750,8 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
{
|
||||
b.Navigation("Antags");
|
||||
|
||||
b.Navigation("Genitals");
|
||||
|
||||
b.Navigation("Jobs");
|
||||
|
||||
b.Navigation("Traits");
|
||||
|
||||
@@ -60,6 +60,10 @@ namespace Content.Server.Database
|
||||
.HasIndex(p => new {HumanoidProfileId = p.ProfileId, p.TraitName})
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<Genital>()
|
||||
.HasIndex(p => new {HumanoidProfileId = p.ProfileId, p.GenitalPrototype })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<Job>()
|
||||
.HasIndex(j => j.ProfileId);
|
||||
|
||||
@@ -314,6 +318,18 @@ namespace Content.Server.Database
|
||||
public float Reputation { get; set; }
|
||||
}
|
||||
// WD end
|
||||
// Amour start
|
||||
public class Genital
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Profile Profile { get; set; } = null!;
|
||||
public int ProfileId { get; set; }
|
||||
|
||||
public string GenitalPrototype { get; set; } = null!;
|
||||
public string Color { get; set; } = null!;
|
||||
|
||||
}
|
||||
// Amour end
|
||||
|
||||
public class Preference
|
||||
{
|
||||
@@ -360,6 +376,7 @@ namespace Content.Server.Database
|
||||
public List<Job> Jobs { get; } = new();
|
||||
public List<Antag> Antags { get; } = new();
|
||||
public List<Trait> Traits { get; } = new();
|
||||
public List<Genital> Genitals { get; } = new();
|
||||
|
||||
[Column("pref_unavailable")] public DbPreferenceUnavailableMode PreferenceUnavailable { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user