Holy crap auth works (#2099)

* Holy crap auth works

* Fix some usages of UserID instead of UserName

* Refactor preferences.

They be non-async now. Also faster.

* Rename DbContext.

* Guest username assignment.

* Fix saving of profiles.

* Don't store data for guests.

* Fix generating invalid random colors.

* Don't allow dumb garbage for char preferences.

* Bans.

* Lol forgot to fill out the command description.

* Connection log.

* Rename all the tables and columns to be snake_case.

* Re-do migrations.

* Fixing tests and warnings.

* Update submodule
This commit is contained in:
Pieter-Jan Briers
2020-09-29 14:26:00 +02:00
committed by GitHub
parent 8a33e0a9bd
commit 66c8a68891
72 changed files with 4144 additions and 2642 deletions

View File

@@ -1,151 +0,0 @@
// <auto-generated />
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresPreferencesDbContext))]
[Migration("20200124133512_InitialPg")]
partial class InitialPg
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnType("integer");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("integer");
b.Property<int>("PrefsId")
.HasColumnType("integer");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Slot")
.HasColumnType("integer");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("text");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnType("integer");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("integer");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,105 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
public partial class InitialPg : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Preferences",
columns: table => new
{
PrefsId = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Username = table.Column<string>(nullable: false),
SelectedCharacterSlot = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Preferences", x => x.PrefsId);
});
migrationBuilder.CreateTable(
name: "HumanoidProfile",
columns: table => new
{
HumanoidProfileId = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slot = table.Column<int>(nullable: false),
SlotName = table.Column<string>(nullable: false),
CharacterName = table.Column<string>(nullable: false),
Age = table.Column<int>(nullable: false),
Sex = table.Column<string>(nullable: false),
HairName = table.Column<string>(nullable: false),
HairColor = table.Column<string>(nullable: false),
FacialHairName = table.Column<string>(nullable: false),
FacialHairColor = table.Column<string>(nullable: false),
EyeColor = table.Column<string>(nullable: false),
SkinColor = table.Column<string>(nullable: false),
PreferenceUnavailable = table.Column<int>(nullable: false),
PrefsId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HumanoidProfile", x => x.HumanoidProfileId);
table.ForeignKey(
name: "FK_HumanoidProfile_Preferences_PrefsId",
column: x => x.PrefsId,
principalTable: "Preferences",
principalColumn: "PrefsId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Job",
columns: table => new
{
JobId = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProfileHumanoidProfileId = table.Column<int>(nullable: false),
JobName = table.Column<string>(nullable: false),
Priority = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Job", x => x.JobId);
table.ForeignKey(
name: "FK_Job_HumanoidProfile_ProfileHumanoidProfileId",
column: x => x.ProfileHumanoidProfileId,
principalTable: "HumanoidProfile",
principalColumn: "HumanoidProfileId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_HumanoidProfile_PrefsId",
table: "HumanoidProfile",
column: "PrefsId");
migrationBuilder.CreateIndex(
name: "IX_Job_ProfileHumanoidProfileId",
table: "Job",
column: "ProfileHumanoidProfileId");
migrationBuilder.CreateIndex(
name: "IX_Preferences_Username",
table: "Preferences",
column: "Username",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Job");
migrationBuilder.DropTable(
name: "HumanoidProfile");
migrationBuilder.DropTable(
name: "Preferences");
}
}
}

View File

@@ -1,154 +0,0 @@
// <auto-generated />
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresPreferencesDbContext))]
[Migration("20200625230829_AddSlotPrefsIdIndex")]
partial class AddSlotPrefsIdIndex
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnType("integer");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("integer");
b.Property<int>("PrefsId")
.HasColumnType("integer");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Slot")
.HasColumnType("integer");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("text");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.HasIndex("Slot", "PrefsId")
.IsUnique();
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnType("integer");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("integer");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Postgres
{
public partial class AddSlotPrefsIdIndex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_HumanoidProfile_Slot_PrefsId",
table: "HumanoidProfile",
columns: new[] { "Slot", "PrefsId" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_HumanoidProfile_Slot_PrefsId",
table: "HumanoidProfile");
}
}
}

View File

@@ -1,185 +0,0 @@
// <auto-generated />
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresPreferencesDbContext))]
[Migration("20200706172726_Antags")]
partial class Antags
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("AntagId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AntagName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("HumanoidProfileId")
.HasColumnType("integer");
b.HasKey("AntagId");
b.HasIndex("HumanoidProfileId", "AntagName")
.IsUnique();
b.ToTable("Antag");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnType("integer");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("integer");
b.Property<int>("PrefsId")
.HasColumnType("integer");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Slot")
.HasColumnType("integer");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("text");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.HasIndex("Slot", "PrefsId")
.IsUnique();
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnType("integer");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("integer");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Antags")
.HasForeignKey("HumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,43 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
public partial class Antags : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Antag",
columns: table => new
{
AntagId = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
HumanoidProfileId = table.Column<int>(nullable: false),
AntagName = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Antag", x => x.AntagId);
table.ForeignKey(
name: "FK_Antag_HumanoidProfile_HumanoidProfileId",
column: x => x.HumanoidProfileId,
principalTable: "HumanoidProfile",
principalColumn: "HumanoidProfileId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Antag_HumanoidProfileId_AntagName",
table: "Antag",
columns: new[] { "HumanoidProfileId", "AntagName" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Antag");
}
}
}

View File

@@ -0,0 +1,391 @@
// <auto-generated />
using System;
using System.Net;
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresServerDbContext))]
[Migration("20200929113117_Init")]
partial class Init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("antag_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AntagName")
.IsRequired()
.HasColumnName("antag_name")
.HasColumnType("text");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProfileId", "AntagName")
.IsUnique();
b.ToTable("antag");
});
modelBuilder.Entity("Content.Server.Database.AssignedUserId", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("assigned_user_id_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.HasIndex("UserName")
.IsUnique();
b.ToTable("assigned_user_id");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("job_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("JobName")
.IsRequired()
.HasColumnName("job_name")
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnName("priority")
.HasColumnType("integer");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProfileId");
b.ToTable("job");
});
modelBuilder.Entity("Content.Server.Database.PostgresConnectionLog", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("connection_log_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<IPAddress>("Address")
.IsRequired()
.HasColumnName("address")
.HasColumnType("inet");
b.Property<DateTime>("Time")
.HasColumnName("time")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("connection_log");
b.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
});
modelBuilder.Entity("Content.Server.Database.PostgresPlayer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("player_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("FirstSeenTime")
.HasColumnName("first_seen_time")
.HasColumnType("timestamp with time zone");
b.Property<IPAddress>("LastSeenAddress")
.IsRequired()
.HasColumnName("last_seen_address")
.HasColumnType("inet");
b.Property<DateTime>("LastSeenTime")
.HasColumnName("last_seen_time")
.HasColumnType("timestamp with time zone");
b.Property<string>("LastSeenUserName")
.IsRequired()
.HasColumnName("last_seen_user_name")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("player");
b.HasCheckConstraint("LastSeenAddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= last_seen_address");
});
modelBuilder.Entity("Content.Server.Database.PostgresServerBan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("server_ban_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<ValueTuple<IPAddress, int>?>("Address")
.HasColumnName("address")
.HasColumnType("inet");
b.Property<DateTime>("BanTime")
.HasColumnName("ban_time")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("BanningAdmin")
.HasColumnName("banning_admin")
.HasColumnType("uuid");
b.Property<DateTime?>("ExpirationTime")
.HasColumnName("expiration_time")
.HasColumnType("timestamp with time zone");
b.Property<string>("Reason")
.IsRequired()
.HasColumnName("reason")
.HasColumnType("text");
b.Property<Guid?>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("Address");
b.HasIndex("UserId");
b.ToTable("server_ban");
b.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
b.HasCheckConstraint("HaveEitherAddressOrUserId", "address IS NOT NULL OR user_id IS NOT NULL");
});
modelBuilder.Entity("Content.Server.Database.PostgresServerUnban", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("unban_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("BanId")
.HasColumnName("ban_id")
.HasColumnType("integer");
b.Property<DateTime>("UnbanTime")
.HasColumnName("unban_time")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("UnbanningAdmin")
.HasColumnName("unbanning_admin")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("BanId")
.IsUnique();
b.ToTable("server_unban");
});
modelBuilder.Entity("Content.Server.Database.Preference", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("preference_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SelectedCharacterSlot")
.HasColumnName("selected_character_slot")
.HasColumnType("integer");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("preference");
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("profile_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnName("age")
.HasColumnType("integer");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnName("char_name")
.HasColumnType("text");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnName("eye_color")
.HasColumnType("text");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnName("facial_hair_color")
.HasColumnType("text");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnName("facial_hair_name")
.HasColumnType("text");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnName("hair_color")
.HasColumnType("text");
b.Property<string>("HairName")
.IsRequired()
.HasColumnName("hair_name")
.HasColumnType("text");
b.Property<int>("PreferenceId")
.HasColumnName("preference_id")
.HasColumnType("integer");
b.Property<int>("PreferenceUnavailable")
.HasColumnName("pref_unavailable")
.HasColumnType("integer");
b.Property<string>("Sex")
.IsRequired()
.HasColumnName("sex")
.HasColumnType("text");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnName("skin_color")
.HasColumnType("text");
b.Property<int>("Slot")
.HasColumnName("slot")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PreferenceId");
b.HasIndex("Slot", "PreferenceId")
.IsUnique();
b.ToTable("profile");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Antags")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.PostgresServerUnban", b =>
{
b.HasOne("Content.Server.Database.PostgresServerBan", "Ban")
.WithOne("Unban")
.HasForeignKey("Content.Server.Database.PostgresServerUnban", "BanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.HasOne("Content.Server.Database.Preference", "Preference")
.WithMany("Profiles")
.HasForeignKey("PreferenceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,285 @@
using System;
using System.Net;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "assigned_user_id",
columns: table => new
{
assigned_user_id_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_name = table.Column<string>(nullable: false),
user_id = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_assigned_user_id", x => x.assigned_user_id_id);
});
migrationBuilder.CreateTable(
name: "connection_log",
columns: table => new
{
connection_log_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column<Guid>(nullable: false),
user_name = table.Column<string>(nullable: false),
time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
address = table.Column<IPAddress>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_connection_log", x => x.connection_log_id);
table.CheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
});
migrationBuilder.CreateTable(
name: "player",
columns: table => new
{
player_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column<Guid>(nullable: false),
first_seen_time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
last_seen_user_name = table.Column<string>(nullable: false),
last_seen_time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
last_seen_address = table.Column<IPAddress>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_player", x => x.player_id);
table.CheckConstraint("LastSeenAddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= last_seen_address");
});
migrationBuilder.CreateTable(
name: "preference",
columns: table => new
{
preference_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column<Guid>(nullable: false),
selected_character_slot = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_preference", x => x.preference_id);
});
migrationBuilder.CreateTable(
name: "server_ban",
columns: table => new
{
server_ban_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column<Guid>(nullable: true),
address = table.Column<ValueTuple<IPAddress, int>>(type: "inet", nullable: true),
ban_time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
expiration_time = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
reason = table.Column<string>(nullable: false),
banning_admin = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_server_ban", x => x.server_ban_id);
table.CheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
table.CheckConstraint("HaveEitherAddressOrUserId", "address IS NOT NULL OR user_id IS NOT NULL");
});
migrationBuilder.CreateTable(
name: "profile",
columns: table => new
{
profile_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
slot = table.Column<int>(nullable: false),
char_name = table.Column<string>(nullable: false),
age = table.Column<int>(nullable: false),
sex = table.Column<string>(nullable: false),
hair_name = table.Column<string>(nullable: false),
hair_color = table.Column<string>(nullable: false),
facial_hair_name = table.Column<string>(nullable: false),
facial_hair_color = table.Column<string>(nullable: false),
eye_color = table.Column<string>(nullable: false),
skin_color = table.Column<string>(nullable: false),
pref_unavailable = table.Column<int>(nullable: false),
preference_id = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_profile", x => x.profile_id);
table.ForeignKey(
name: "FK_profile_preference_preference_id",
column: x => x.preference_id,
principalTable: "preference",
principalColumn: "preference_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "server_unban",
columns: table => new
{
unban_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ban_id = table.Column<int>(nullable: false),
unbanning_admin = table.Column<Guid>(nullable: true),
unban_time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_server_unban", x => x.unban_id);
table.ForeignKey(
name: "FK_server_unban_server_ban_ban_id",
column: x => x.ban_id,
principalTable: "server_ban",
principalColumn: "server_ban_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "antag",
columns: table => new
{
antag_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
profile_id = table.Column<int>(nullable: false),
antag_name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_antag", x => x.antag_id);
table.ForeignKey(
name: "FK_antag_profile_profile_id",
column: x => x.profile_id,
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "job",
columns: table => new
{
job_id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
profile_id = table.Column<int>(nullable: false),
job_name = table.Column<string>(nullable: false),
priority = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_job", x => x.job_id);
table.ForeignKey(
name: "FK_job_profile_profile_id",
column: x => x.profile_id,
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_antag_profile_id_antag_name",
table: "antag",
columns: new[] { "profile_id", "antag_name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_assigned_user_id_user_id",
table: "assigned_user_id",
column: "user_id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_assigned_user_id_user_name",
table: "assigned_user_id",
column: "user_name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_connection_log_user_id",
table: "connection_log",
column: "user_id");
migrationBuilder.CreateIndex(
name: "IX_job_profile_id",
table: "job",
column: "profile_id");
migrationBuilder.CreateIndex(
name: "IX_player_user_id",
table: "player",
column: "user_id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_preference_user_id",
table: "preference",
column: "user_id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_profile_preference_id",
table: "profile",
column: "preference_id");
migrationBuilder.CreateIndex(
name: "IX_profile_slot_preference_id",
table: "profile",
columns: new[] { "slot", "preference_id" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_server_ban_address",
table: "server_ban",
column: "address");
migrationBuilder.CreateIndex(
name: "IX_server_ban_user_id",
table: "server_ban",
column: "user_id");
migrationBuilder.CreateIndex(
name: "IX_server_unban_ban_id",
table: "server_unban",
column: "ban_id",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "antag");
migrationBuilder.DropTable(
name: "assigned_user_id");
migrationBuilder.DropTable(
name: "connection_log");
migrationBuilder.DropTable(
name: "job");
migrationBuilder.DropTable(
name: "player");
migrationBuilder.DropTable(
name: "server_unban");
migrationBuilder.DropTable(
name: "profile");
migrationBuilder.DropTable(
name: "server_ban");
migrationBuilder.DropTable(
name: "preference");
}
}
}

View File

@@ -1,182 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresPreferencesDbContext))]
partial class PostgresPreferencesDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("AntagId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AntagName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("HumanoidProfileId")
.HasColumnType("integer");
b.HasKey("AntagId");
b.HasIndex("HumanoidProfileId", "AntagName")
.IsUnique();
b.ToTable("Antag");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnType("integer");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("integer");
b.Property<int>("PrefsId")
.HasColumnType("integer");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Slot")
.HasColumnType("integer");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("text");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.HasIndex("Slot", "PrefsId")
.IsUnique();
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnType("integer");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("integer");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Antags")
.HasForeignKey("HumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,389 @@
// <auto-generated />
using System;
using System.Net;
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresServerDbContext))]
partial class PostgresServerDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("antag_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AntagName")
.IsRequired()
.HasColumnName("antag_name")
.HasColumnType("text");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProfileId", "AntagName")
.IsUnique();
b.ToTable("antag");
});
modelBuilder.Entity("Content.Server.Database.AssignedUserId", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("assigned_user_id_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.HasIndex("UserName")
.IsUnique();
b.ToTable("assigned_user_id");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("job_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("JobName")
.IsRequired()
.HasColumnName("job_name")
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnName("priority")
.HasColumnType("integer");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProfileId");
b.ToTable("job");
});
modelBuilder.Entity("Content.Server.Database.PostgresConnectionLog", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("connection_log_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<IPAddress>("Address")
.IsRequired()
.HasColumnName("address")
.HasColumnType("inet");
b.Property<DateTime>("Time")
.HasColumnName("time")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("connection_log");
b.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
});
modelBuilder.Entity("Content.Server.Database.PostgresPlayer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("player_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("FirstSeenTime")
.HasColumnName("first_seen_time")
.HasColumnType("timestamp with time zone");
b.Property<IPAddress>("LastSeenAddress")
.IsRequired()
.HasColumnName("last_seen_address")
.HasColumnType("inet");
b.Property<DateTime>("LastSeenTime")
.HasColumnName("last_seen_time")
.HasColumnType("timestamp with time zone");
b.Property<string>("LastSeenUserName")
.IsRequired()
.HasColumnName("last_seen_user_name")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("player");
b.HasCheckConstraint("LastSeenAddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= last_seen_address");
});
modelBuilder.Entity("Content.Server.Database.PostgresServerBan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("server_ban_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<ValueTuple<IPAddress, int>?>("Address")
.HasColumnName("address")
.HasColumnType("inet");
b.Property<DateTime>("BanTime")
.HasColumnName("ban_time")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("BanningAdmin")
.HasColumnName("banning_admin")
.HasColumnType("uuid");
b.Property<DateTime?>("ExpirationTime")
.HasColumnName("expiration_time")
.HasColumnType("timestamp with time zone");
b.Property<string>("Reason")
.IsRequired()
.HasColumnName("reason")
.HasColumnType("text");
b.Property<Guid?>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("Address");
b.HasIndex("UserId");
b.ToTable("server_ban");
b.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
b.HasCheckConstraint("HaveEitherAddressOrUserId", "address IS NOT NULL OR user_id IS NOT NULL");
});
modelBuilder.Entity("Content.Server.Database.PostgresServerUnban", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("unban_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("BanId")
.HasColumnName("ban_id")
.HasColumnType("integer");
b.Property<DateTime>("UnbanTime")
.HasColumnName("unban_time")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("UnbanningAdmin")
.HasColumnName("unbanning_admin")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("BanId")
.IsUnique();
b.ToTable("server_unban");
});
modelBuilder.Entity("Content.Server.Database.Preference", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("preference_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SelectedCharacterSlot")
.HasColumnName("selected_character_slot")
.HasColumnType("integer");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("preference");
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("profile_id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnName("age")
.HasColumnType("integer");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnName("char_name")
.HasColumnType("text");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnName("eye_color")
.HasColumnType("text");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnName("facial_hair_color")
.HasColumnType("text");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnName("facial_hair_name")
.HasColumnType("text");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnName("hair_color")
.HasColumnType("text");
b.Property<string>("HairName")
.IsRequired()
.HasColumnName("hair_name")
.HasColumnType("text");
b.Property<int>("PreferenceId")
.HasColumnName("preference_id")
.HasColumnType("integer");
b.Property<int>("PreferenceUnavailable")
.HasColumnName("pref_unavailable")
.HasColumnType("integer");
b.Property<string>("Sex")
.IsRequired()
.HasColumnName("sex")
.HasColumnType("text");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnName("skin_color")
.HasColumnType("text");
b.Property<int>("Slot")
.HasColumnName("slot")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PreferenceId");
b.HasIndex("Slot", "PreferenceId")
.IsUnique();
b.ToTable("profile");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Antags")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.PostgresServerUnban", b =>
{
b.HasOne("Content.Server.Database.PostgresServerBan", "Ban")
.WithOne("Unban")
.HasForeignKey("Content.Server.Database.PostgresServerUnban", "BanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.HasOne("Content.Server.Database.Preference", "Preference")
.WithMany("Profiles")
.HasForeignKey("PreferenceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,109 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqlitePreferencesDbContext))]
[Migration("20200118020532_initial")]
partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.0");
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PrefsId")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnType("INTEGER");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,74 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Preferences",
columns: table => new
{
PrefsId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Username = table.Column<string>(nullable: false),
SelectedCharacterSlot = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Preferences", x => x.PrefsId);
});
migrationBuilder.CreateTable(
name: "HumanoidProfile",
columns: table => new
{
HumanoidProfileId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Slot = table.Column<int>(nullable: false),
SlotName = table.Column<string>(nullable: false),
CharacterName = table.Column<string>(nullable: false),
Age = table.Column<int>(nullable: false),
Sex = table.Column<string>(nullable: false),
HairName = table.Column<string>(nullable: false),
HairColor = table.Column<string>(nullable: false),
FacialHairName = table.Column<string>(nullable: false),
FacialHairColor = table.Column<string>(nullable: false),
EyeColor = table.Column<string>(nullable: false),
SkinColor = table.Column<string>(nullable: false),
PrefsId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HumanoidProfile", x => x.HumanoidProfileId);
table.ForeignKey(
name: "FK_HumanoidProfile_Preferences_PrefsId",
column: x => x.PrefsId,
principalTable: "Preferences",
principalColumn: "PrefsId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_HumanoidProfile_PrefsId",
table: "HumanoidProfile",
column: "PrefsId");
migrationBuilder.CreateIndex(
name: "IX_Preferences_Username",
table: "Preferences",
column: "Username",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "HumanoidProfile");
migrationBuilder.DropTable(
name: "Preferences");
}
}
}

View File

@@ -1,141 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqlitePreferencesDbContext))]
[Migration("20200118195640_jobs")]
partial class jobs
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.0");
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PrefsId")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnType("INTEGER");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,42 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class jobs : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Job",
columns: table => new
{
JobId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProfileHumanoidProfileId = table.Column<int>(nullable: false),
JobName = table.Column<string>(nullable: false),
Priority = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Job", x => x.JobId);
table.ForeignKey(
name: "FK_Job_HumanoidProfile_ProfileHumanoidProfileId",
column: x => x.ProfileHumanoidProfileId,
principalTable: "HumanoidProfile",
principalColumn: "HumanoidProfileId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Job_ProfileHumanoidProfileId",
table: "Job",
column: "ProfileHumanoidProfileId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Job");
}
}
}

View File

@@ -1,144 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqlitePreferencesDbContext))]
[Migration("20200119103426_preferenceUnavailable")]
partial class preferenceUnavailable
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.0");
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("INTEGER");
b.Property<int>("PrefsId")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnType("INTEGER");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class preferenceUnavailable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "PreferenceUnavailable",
table: "HumanoidProfile",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PreferenceUnavailable",
table: "HumanoidProfile");
}
}
}

View File

@@ -1,148 +0,0 @@
// <auto-generated />
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqlitePreferencesDbContext))]
[Migration("20200625230839_AddSlotPrefsIdIndex")]
partial class AddSlotPrefsIdIndex
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.4");
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("INTEGER");
b.Property<int>("PrefsId")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnType("INTEGER");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.HasIndex("Slot", "PrefsId")
.IsUnique();
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class AddSlotPrefsIdIndex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_HumanoidProfile_Slot_PrefsId",
table: "HumanoidProfile",
columns: new[] { "Slot", "PrefsId" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_HumanoidProfile_Slot_PrefsId",
table: "HumanoidProfile");
}
}
}

View File

@@ -1,178 +0,0 @@
// <auto-generated />
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqlitePreferencesDbContext))]
[Migration("20200706172741_Antags")]
partial class Antags
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.4");
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("AntagId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AntagName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("HumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("AntagId");
b.HasIndex("HumanoidProfileId", "AntagName")
.IsUnique();
b.ToTable("Antag");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("INTEGER");
b.Property<int>("PrefsId")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnType("INTEGER");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.HasIndex("Slot", "PrefsId")
.IsUnique();
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Antags")
.HasForeignKey("HumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,42 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class Antags : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Antag",
columns: table => new
{
AntagId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
HumanoidProfileId = table.Column<int>(nullable: false),
AntagName = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Antag", x => x.AntagId);
table.ForeignKey(
name: "FK_Antag_HumanoidProfile_HumanoidProfileId",
column: x => x.HumanoidProfileId,
principalTable: "HumanoidProfile",
principalColumn: "HumanoidProfileId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Antag_HumanoidProfileId_AntagName",
table: "Antag",
columns: new[] { "HumanoidProfileId", "AntagName" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Antag");
}
}
}

View File

@@ -0,0 +1,361 @@
// <auto-generated />
using System;
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqliteServerDbContext))]
[Migration("20200929113112_Init")]
partial class Init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.4");
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("antag_id")
.HasColumnType("INTEGER");
b.Property<string>("AntagName")
.IsRequired()
.HasColumnName("antag_name")
.HasColumnType("TEXT");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProfileId", "AntagName")
.IsUnique();
b.ToTable("antag");
});
modelBuilder.Entity("Content.Server.Database.AssignedUserId", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("assigned_user_id_id")
.HasColumnType("INTEGER");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.HasIndex("UserName")
.IsUnique();
b.ToTable("assigned_user_id");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("job_id")
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnName("job_name")
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnName("priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProfileId");
b.ToTable("job");
});
modelBuilder.Entity("Content.Server.Database.Preference", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("preference_id")
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnName("selected_character_slot")
.HasColumnType("INTEGER");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("preference");
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("profile_id")
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnName("age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnName("char_name")
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnName("eye_color")
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnName("facial_hair_color")
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnName("facial_hair_name")
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnName("hair_color")
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnName("hair_name")
.HasColumnType("TEXT");
b.Property<int>("PreferenceId")
.HasColumnName("preference_id")
.HasColumnType("INTEGER");
b.Property<int>("PreferenceUnavailable")
.HasColumnName("pref_unavailable")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnName("sex")
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnName("skin_color")
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnName("slot")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PreferenceId");
b.HasIndex("Slot", "PreferenceId")
.IsUnique();
b.ToTable("profile");
});
modelBuilder.Entity("Content.Server.Database.SqliteConnectionLog", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("connection_log_id")
.HasColumnType("INTEGER");
b.Property<string>("Address")
.IsRequired()
.HasColumnName("address")
.HasColumnType("TEXT");
b.Property<DateTime>("Time")
.HasColumnName("time")
.HasColumnType("TEXT");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("connection_log");
});
modelBuilder.Entity("Content.Server.Database.SqlitePlayer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("player_id")
.HasColumnType("INTEGER");
b.Property<DateTime>("FirstSeenTime")
.HasColumnName("first_seen_time")
.HasColumnType("TEXT");
b.Property<string>("LastSeenAddress")
.IsRequired()
.HasColumnName("last_seen_address")
.HasColumnType("TEXT");
b.Property<DateTime>("LastSeenTime")
.HasColumnName("last_seen_time")
.HasColumnType("TEXT");
b.Property<string>("LastSeenUserName")
.IsRequired()
.HasColumnName("last_seen_user_name")
.HasColumnType("TEXT");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("player");
});
modelBuilder.Entity("Content.Server.Database.SqliteServerBan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("ban_id")
.HasColumnType("INTEGER");
b.Property<string>("Address")
.HasColumnName("address")
.HasColumnType("TEXT");
b.Property<DateTime>("BanTime")
.HasColumnName("ban_time")
.HasColumnType("TEXT");
b.Property<Guid?>("BanningAdmin")
.HasColumnName("banning_admin")
.HasColumnType("TEXT");
b.Property<DateTime?>("ExpirationTime")
.HasColumnName("expiration_time")
.HasColumnType("TEXT");
b.Property<string>("Reason")
.IsRequired()
.HasColumnName("reason")
.HasColumnType("TEXT");
b.Property<Guid?>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("ban");
});
modelBuilder.Entity("Content.Server.Database.SqliteServerUnban", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("unban_id")
.HasColumnType("INTEGER");
b.Property<int>("BanId")
.HasColumnName("ban_id")
.HasColumnType("INTEGER");
b.Property<DateTime>("UnbanTime")
.HasColumnName("unban_time")
.HasColumnType("TEXT");
b.Property<Guid?>("UnbanningAdmin")
.HasColumnName("unbanning_admin")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("BanId")
.IsUnique();
b.ToTable("unban");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Antags")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.HasOne("Content.Server.Database.Preference", "Preference")
.WithMany("Profiles")
.HasForeignKey("PreferenceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.SqliteServerUnban", b =>
{
b.HasOne("Content.Server.Database.SqliteServerBan", "Ban")
.WithOne("Unban")
.HasForeignKey("Content.Server.Database.SqliteServerUnban", "BanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,258 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "assigned_user_id",
columns: table => new
{
assigned_user_id_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
user_name = table.Column<string>(nullable: false),
user_id = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_assigned_user_id", x => x.assigned_user_id_id);
});
migrationBuilder.CreateTable(
name: "ban",
columns: table => new
{
ban_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
user_id = table.Column<Guid>(nullable: true),
address = table.Column<string>(nullable: true),
ban_time = table.Column<DateTime>(nullable: false),
expiration_time = table.Column<DateTime>(nullable: true),
reason = table.Column<string>(nullable: false),
banning_admin = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ban", x => x.ban_id);
});
migrationBuilder.CreateTable(
name: "connection_log",
columns: table => new
{
connection_log_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
user_id = table.Column<Guid>(nullable: false),
user_name = table.Column<string>(nullable: false),
time = table.Column<DateTime>(nullable: false),
address = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_connection_log", x => x.connection_log_id);
});
migrationBuilder.CreateTable(
name: "player",
columns: table => new
{
player_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
user_id = table.Column<Guid>(nullable: false),
first_seen_time = table.Column<DateTime>(nullable: false),
last_seen_user_name = table.Column<string>(nullable: false),
last_seen_time = table.Column<DateTime>(nullable: false),
last_seen_address = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_player", x => x.player_id);
});
migrationBuilder.CreateTable(
name: "preference",
columns: table => new
{
preference_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
user_id = table.Column<Guid>(nullable: false),
selected_character_slot = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_preference", x => x.preference_id);
});
migrationBuilder.CreateTable(
name: "unban",
columns: table => new
{
unban_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ban_id = table.Column<int>(nullable: false),
unbanning_admin = table.Column<Guid>(nullable: true),
unban_time = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_unban", x => x.unban_id);
table.ForeignKey(
name: "FK_unban_ban_ban_id",
column: x => x.ban_id,
principalTable: "ban",
principalColumn: "ban_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "profile",
columns: table => new
{
profile_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
slot = table.Column<int>(nullable: false),
char_name = table.Column<string>(nullable: false),
age = table.Column<int>(nullable: false),
sex = table.Column<string>(nullable: false),
hair_name = table.Column<string>(nullable: false),
hair_color = table.Column<string>(nullable: false),
facial_hair_name = table.Column<string>(nullable: false),
facial_hair_color = table.Column<string>(nullable: false),
eye_color = table.Column<string>(nullable: false),
skin_color = table.Column<string>(nullable: false),
pref_unavailable = table.Column<int>(nullable: false),
preference_id = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_profile", x => x.profile_id);
table.ForeignKey(
name: "FK_profile_preference_preference_id",
column: x => x.preference_id,
principalTable: "preference",
principalColumn: "preference_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "antag",
columns: table => new
{
antag_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
profile_id = table.Column<int>(nullable: false),
antag_name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_antag", x => x.antag_id);
table.ForeignKey(
name: "FK_antag_profile_profile_id",
column: x => x.profile_id,
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "job",
columns: table => new
{
job_id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
profile_id = table.Column<int>(nullable: false),
job_name = table.Column<string>(nullable: false),
priority = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_job", x => x.job_id);
table.ForeignKey(
name: "FK_job_profile_profile_id",
column: x => x.profile_id,
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_antag_profile_id_antag_name",
table: "antag",
columns: new[] { "profile_id", "antag_name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_assigned_user_id_user_id",
table: "assigned_user_id",
column: "user_id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_assigned_user_id_user_name",
table: "assigned_user_id",
column: "user_name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_job_profile_id",
table: "job",
column: "profile_id");
migrationBuilder.CreateIndex(
name: "IX_preference_user_id",
table: "preference",
column: "user_id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_profile_preference_id",
table: "profile",
column: "preference_id");
migrationBuilder.CreateIndex(
name: "IX_profile_slot_preference_id",
table: "profile",
columns: new[] { "slot", "preference_id" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_unban_ban_id",
table: "unban",
column: "ban_id",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "antag");
migrationBuilder.DropTable(
name: "assigned_user_id");
migrationBuilder.DropTable(
name: "connection_log");
migrationBuilder.DropTable(
name: "job");
migrationBuilder.DropTable(
name: "player");
migrationBuilder.DropTable(
name: "unban");
migrationBuilder.DropTable(
name: "profile");
migrationBuilder.DropTable(
name: "ban");
migrationBuilder.DropTable(
name: "preference");
}
}
}

View File

@@ -1,175 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqlitePreferencesDbContext))]
partial class SqlitePreferencesDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.4");
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("AntagId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AntagName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("HumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("AntagId");
b.HasIndex("HumanoidProfileId", "AntagName")
.IsUnique();
b.ToTable("Antag");
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.Property<int>("HumanoidProfileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PreferenceUnavailable")
.HasColumnType("INTEGER");
b.Property<int>("PrefsId")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnType("INTEGER");
b.Property<string>("SlotName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("HumanoidProfileId");
b.HasIndex("PrefsId");
b.HasIndex("Slot", "PrefsId")
.IsUnique();
b.ToTable("HumanoidProfile");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("JobId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileHumanoidProfileId")
.HasColumnType("INTEGER");
b.HasKey("JobId");
b.HasIndex("ProfileHumanoidProfileId");
b.ToTable("Job");
});
modelBuilder.Entity("Content.Server.Database.Prefs", b =>
{
b.Property<int>("PrefsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PrefsId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Preferences");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Antags")
.HasForeignKey("HumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b =>
{
b.HasOne("Content.Server.Database.Prefs", "Prefs")
.WithMany("HumanoidProfiles")
.HasForeignKey("PrefsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.HumanoidProfile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileHumanoidProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,359 @@
// <auto-generated />
using System;
using Content.Server.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Content.Server.Database.Migrations.Sqlite
{
[DbContext(typeof(SqliteServerDbContext))]
partial class SqliteServerDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.4");
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("antag_id")
.HasColumnType("INTEGER");
b.Property<string>("AntagName")
.IsRequired()
.HasColumnName("antag_name")
.HasColumnType("TEXT");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProfileId", "AntagName")
.IsUnique();
b.ToTable("antag");
});
modelBuilder.Entity("Content.Server.Database.AssignedUserId", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("assigned_user_id_id")
.HasColumnType("INTEGER");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.HasIndex("UserName")
.IsUnique();
b.ToTable("assigned_user_id");
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("job_id")
.HasColumnType("INTEGER");
b.Property<string>("JobName")
.IsRequired()
.HasColumnName("job_name")
.HasColumnType("TEXT");
b.Property<int>("Priority")
.HasColumnName("priority")
.HasColumnType("INTEGER");
b.Property<int>("ProfileId")
.HasColumnName("profile_id")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProfileId");
b.ToTable("job");
});
modelBuilder.Entity("Content.Server.Database.Preference", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("preference_id")
.HasColumnType("INTEGER");
b.Property<int>("SelectedCharacterSlot")
.HasColumnName("selected_character_slot")
.HasColumnType("INTEGER");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("preference");
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("profile_id")
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnName("age")
.HasColumnType("INTEGER");
b.Property<string>("CharacterName")
.IsRequired()
.HasColumnName("char_name")
.HasColumnType("TEXT");
b.Property<string>("EyeColor")
.IsRequired()
.HasColumnName("eye_color")
.HasColumnType("TEXT");
b.Property<string>("FacialHairColor")
.IsRequired()
.HasColumnName("facial_hair_color")
.HasColumnType("TEXT");
b.Property<string>("FacialHairName")
.IsRequired()
.HasColumnName("facial_hair_name")
.HasColumnType("TEXT");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnName("hair_color")
.HasColumnType("TEXT");
b.Property<string>("HairName")
.IsRequired()
.HasColumnName("hair_name")
.HasColumnType("TEXT");
b.Property<int>("PreferenceId")
.HasColumnName("preference_id")
.HasColumnType("INTEGER");
b.Property<int>("PreferenceUnavailable")
.HasColumnName("pref_unavailable")
.HasColumnType("INTEGER");
b.Property<string>("Sex")
.IsRequired()
.HasColumnName("sex")
.HasColumnType("TEXT");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnName("skin_color")
.HasColumnType("TEXT");
b.Property<int>("Slot")
.HasColumnName("slot")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PreferenceId");
b.HasIndex("Slot", "PreferenceId")
.IsUnique();
b.ToTable("profile");
});
modelBuilder.Entity("Content.Server.Database.SqliteConnectionLog", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("connection_log_id")
.HasColumnType("INTEGER");
b.Property<string>("Address")
.IsRequired()
.HasColumnName("address")
.HasColumnType("TEXT");
b.Property<DateTime>("Time")
.HasColumnName("time")
.HasColumnType("TEXT");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("connection_log");
});
modelBuilder.Entity("Content.Server.Database.SqlitePlayer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("player_id")
.HasColumnType("INTEGER");
b.Property<DateTime>("FirstSeenTime")
.HasColumnName("first_seen_time")
.HasColumnType("TEXT");
b.Property<string>("LastSeenAddress")
.IsRequired()
.HasColumnName("last_seen_address")
.HasColumnType("TEXT");
b.Property<DateTime>("LastSeenTime")
.HasColumnName("last_seen_time")
.HasColumnType("TEXT");
b.Property<string>("LastSeenUserName")
.IsRequired()
.HasColumnName("last_seen_user_name")
.HasColumnType("TEXT");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("player");
});
modelBuilder.Entity("Content.Server.Database.SqliteServerBan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("ban_id")
.HasColumnType("INTEGER");
b.Property<string>("Address")
.HasColumnName("address")
.HasColumnType("TEXT");
b.Property<DateTime>("BanTime")
.HasColumnName("ban_time")
.HasColumnType("TEXT");
b.Property<Guid?>("BanningAdmin")
.HasColumnName("banning_admin")
.HasColumnType("TEXT");
b.Property<DateTime?>("ExpirationTime")
.HasColumnName("expiration_time")
.HasColumnType("TEXT");
b.Property<string>("Reason")
.IsRequired()
.HasColumnName("reason")
.HasColumnType("TEXT");
b.Property<Guid?>("UserId")
.HasColumnName("user_id")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("ban");
});
modelBuilder.Entity("Content.Server.Database.SqliteServerUnban", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("unban_id")
.HasColumnType("INTEGER");
b.Property<int>("BanId")
.HasColumnName("ban_id")
.HasColumnType("INTEGER");
b.Property<DateTime>("UnbanTime")
.HasColumnName("unban_time")
.HasColumnType("TEXT");
b.Property<Guid?>("UnbanningAdmin")
.HasColumnName("unbanning_admin")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("BanId")
.IsUnique();
b.ToTable("unban");
});
modelBuilder.Entity("Content.Server.Database.Antag", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Antags")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Job", b =>
{
b.HasOne("Content.Server.Database.Profile", "Profile")
.WithMany("Jobs")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.Profile", b =>
{
b.HasOne("Content.Server.Database.Preference", "Preference")
.WithMany("Profiles")
.HasForeignKey("PreferenceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Content.Server.Database.SqliteServerUnban", b =>
{
b.HasOne("Content.Server.Database.SqliteServerBan", "Ban")
.WithOne("Unban")
.HasForeignKey("Content.Server.Database.SqliteServerUnban", "BanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}