Server ban exemption system (#15076)

This commit is contained in:
Pieter-Jan Briers
2023-04-03 02:24:55 +02:00
committed by GitHub
parent e037d12899
commit c8e90e561b
26 changed files with 8681 additions and 135 deletions

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Database.Migrations.Sqlite
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.5");
modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
modelBuilder.Entity("Content.Server.Database.Admin", b =>
{
@@ -278,8 +278,7 @@ namespace Content.Server.Database.Migrations.Sqlite
b.HasKey("Id")
.HasName("PK_admin_rank_flag");
b.HasIndex("AdminRankId")
.HasDatabaseName("IX_admin_rank_flag_admin_rank_id");
b.HasIndex("AdminRankId");
b.HasIndex("Flag", "AdminRankId")
.IsUnique();
@@ -404,8 +403,7 @@ namespace Content.Server.Database.Migrations.Sqlite
b.HasKey("Id")
.HasName("PK_job");
b.HasIndex("ProfileId")
.HasDatabaseName("IX_job_profile_id");
b.HasIndex("ProfileId");
b.HasIndex("ProfileId", "JobName")
.IsUnique();
@@ -417,6 +415,35 @@ namespace Content.Server.Database.Migrations.Sqlite
b.ToTable("job", (string)null);
});
modelBuilder.Entity("Content.Server.Database.PlayTime", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasColumnName("play_time_id");
b.Property<Guid>("PlayerId")
.HasColumnType("TEXT")
.HasColumnName("player_id");
b.Property<TimeSpan>("TimeSpent")
.HasColumnType("TEXT")
.HasColumnName("time_spent");
b.Property<string>("Tracker")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("tracker");
b.HasKey("Id")
.HasName("PK_play_time");
b.HasIndex("PlayerId", "Tracker")
.IsUnique();
b.ToTable("play_time", (string)null);
});
modelBuilder.Entity("Content.Server.Database.Player", b =>
{
b.Property<int>("Id")
@@ -468,35 +495,6 @@ namespace Content.Server.Database.Migrations.Sqlite
b.ToTable("player", (string)null);
});
modelBuilder.Entity("Content.Server.Database.PlayTime", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasColumnName("play_time_id");
b.Property<Guid>("PlayerId")
.HasColumnType("TEXT")
.HasColumnName("player_id");
b.Property<TimeSpan>("TimeSpent")
.HasColumnType("TEXT")
.HasColumnName("time_spent");
b.Property<string>("Tracker")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("tracker");
b.HasKey("Id")
.HasName("PK_play_time");
b.HasIndex("PlayerId", "Tracker")
.IsUnique();
b.ToTable("play_time", (string)null);
});
modelBuilder.Entity("Content.Server.Database.Preference", b =>
{
b.Property<int>("Id")
@@ -679,6 +677,10 @@ namespace Content.Server.Database.Migrations.Sqlite
.HasColumnType("TEXT")
.HasColumnName("address");
b.Property<bool>("AutoDelete")
.HasColumnType("INTEGER")
.HasColumnName("auto_delete");
b.Property<DateTime>("BanTime")
.HasColumnType("TEXT")
.HasColumnName("ban_time");
@@ -687,6 +689,10 @@ namespace Content.Server.Database.Migrations.Sqlite
.HasColumnType("TEXT")
.HasColumnName("banning_admin");
b.Property<int>("ExemptFlags")
.HasColumnType("INTEGER")
.HasColumnName("exempt_flags");
b.Property<DateTime?>("ExpirationTime")
.HasColumnType("TEXT")
.HasColumnName("expiration_time");
@@ -711,9 +717,30 @@ namespace Content.Server.Database.Migrations.Sqlite
b.HasIndex("UserId");
b.ToTable("server_ban", (string)null);
b.ToTable("server_ban", null, t =>
{
t.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR user_id IS NOT NULL OR hwid IS NOT NULL");
});
});
b.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR user_id IS NOT NULL OR hwid IS NOT NULL");
modelBuilder.Entity("Content.Server.Database.ServerBanExemption", b =>
{
b.Property<Guid>("UserId")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("user_id");
b.Property<int>("Flags")
.HasColumnType("INTEGER")
.HasColumnName("flags");
b.HasKey("UserId")
.HasName("PK_server_ban_exemption");
b.ToTable("server_ban_exemption", null, t =>
{
t.HasCheckConstraint("FlagsNotZero", "flags != 0");
});
});
modelBuilder.Entity("Content.Server.Database.ServerBanHit", b =>
@@ -791,9 +818,10 @@ namespace Content.Server.Database.Migrations.Sqlite
b.HasIndex("UserId");
b.ToTable("server_role_ban", (string)null);
b.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR user_id IS NOT NULL OR hwid IS NOT NULL");
b.ToTable("server_role_ban", null, t =>
{
t.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR user_id IS NOT NULL OR hwid IS NOT NULL");
});
});
modelBuilder.Entity("Content.Server.Database.ServerRoleUnban", b =>
@@ -871,8 +899,8 @@ namespace Content.Server.Database.Migrations.Sqlite
b.HasKey("Id")
.HasName("PK_trait");
b.HasIndex("ProfileId")
.HasDatabaseName("IX_trait_profile_id");
b.HasIndex("ProfileId", "TraitName")
.IsUnique();
b.ToTable("trait", (string)null);
});