GDPR stuff update (#18300)
This commit is contained in:
committed by
GitHub
parent
86f33a8fa2
commit
e0c4884995
1770
Content.Server.Database/Migrations/Postgres/20230725193102_AdminNotesImprovementsForeignKeys.Designer.cs
generated
Normal file
1770
Content.Server.Database/Migrations/Postgres/20230725193102_AdminNotesImprovementsForeignKeys.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Postgres
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AdminNotesImprovementsForeignKeys : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// <auto-generated />
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
@@ -317,10 +317,6 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<int>("Severity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("severity");
|
||||
|
||||
b.Property<Guid?>("PlayerUserId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("player_user_id");
|
||||
@@ -337,6 +333,10 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("secret");
|
||||
|
||||
b.Property<int>("Severity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("severity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK_admin_notes");
|
||||
|
||||
@@ -1364,7 +1364,7 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
.WithMany("AdminMessagesReceived")
|
||||
.HasForeignKey("PlayerUserId")
|
||||
.HasPrincipalKey("UserId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_admin_messages_player_player_user_id");
|
||||
|
||||
b.HasOne("Content.Server.Database.Round", "Round")
|
||||
@@ -1410,7 +1410,7 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
.WithMany("AdminNotesReceived")
|
||||
.HasForeignKey("PlayerUserId")
|
||||
.HasPrincipalKey("UserId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_admin_notes_player_player_user_id");
|
||||
|
||||
b.HasOne("Content.Server.Database.Round", "Round")
|
||||
@@ -1468,7 +1468,7 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
.WithMany("AdminWatchlistsReceived")
|
||||
.HasForeignKey("PlayerUserId")
|
||||
.HasPrincipalKey("UserId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_admin_watchlists_player_player_user_id");
|
||||
|
||||
b.HasOne("Content.Server.Database.Round", "Round")
|
||||
|
||||
1698
Content.Server.Database/Migrations/Sqlite/20230725193058_AdminNotesImprovementsForeignKeys.Designer.cs
generated
Normal file
1698
Content.Server.Database/Migrations/Sqlite/20230725193058_AdminNotesImprovementsForeignKeys.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AdminNotesImprovementsForeignKeys : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_messages_player_player_user_id",
|
||||
table: "admin_messages",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_notes_player_player_user_id",
|
||||
table: "admin_notes",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_admin_watchlists_player_player_user_id",
|
||||
table: "admin_watchlists",
|
||||
column: "player_user_id",
|
||||
principalTable: "player",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// <auto-generated />
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Content.Server.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -295,10 +295,6 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<int>("Severity")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("severity");
|
||||
|
||||
b.Property<Guid?>("PlayerUserId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("player_user_id");
|
||||
@@ -315,6 +311,10 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("secret");
|
||||
|
||||
b.Property<int>("Severity")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("severity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK_admin_notes");
|
||||
|
||||
@@ -1292,7 +1292,7 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
.WithMany("AdminMessagesReceived")
|
||||
.HasForeignKey("PlayerUserId")
|
||||
.HasPrincipalKey("UserId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_admin_messages_player_player_user_id");
|
||||
|
||||
b.HasOne("Content.Server.Database.Round", "Round")
|
||||
@@ -1338,7 +1338,7 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
.WithMany("AdminNotesReceived")
|
||||
.HasForeignKey("PlayerUserId")
|
||||
.HasPrincipalKey("UserId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_admin_notes_player_player_user_id");
|
||||
|
||||
b.HasOne("Content.Server.Database.Round", "Round")
|
||||
@@ -1396,7 +1396,7 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
.WithMany("AdminWatchlistsReceived")
|
||||
.HasForeignKey("PlayerUserId")
|
||||
.HasPrincipalKey("UserId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_admin_watchlists_player_player_user_id");
|
||||
|
||||
b.HasOne("Content.Server.Database.Round", "Round")
|
||||
|
||||
@@ -162,13 +162,15 @@ namespace Content.Server.Database
|
||||
modelBuilder.Entity<ConnectionLog>()
|
||||
.HasIndex(p => p.UserId);
|
||||
|
||||
// SetNull is necessary here so you can safely delete admins (GDPR right to erasure) while keeping the notes intact
|
||||
// SetNull is necessary for created by/edited by-s here,
|
||||
// so you can safely delete admins (GDPR right to erasure) while keeping the notes intact
|
||||
|
||||
modelBuilder.Entity<AdminNote>()
|
||||
.HasOne(note => note.Player)
|
||||
.WithMany(player => player.AdminNotesReceived)
|
||||
.HasForeignKey(note => note.PlayerUserId)
|
||||
.HasPrincipalKey(player => player.UserId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<AdminNote>()
|
||||
.HasOne(version => version.CreatedBy)
|
||||
@@ -196,7 +198,7 @@ namespace Content.Server.Database
|
||||
.WithMany(player => player.AdminWatchlistsReceived)
|
||||
.HasForeignKey(note => note.PlayerUserId)
|
||||
.HasPrincipalKey(player => player.UserId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<AdminWatchlist>()
|
||||
.HasOne(version => version.CreatedBy)
|
||||
@@ -224,7 +226,7 @@ namespace Content.Server.Database
|
||||
.WithMany(player => player.AdminMessagesReceived)
|
||||
.HasForeignKey(note => note.PlayerUserId)
|
||||
.HasPrincipalKey(player => player.UserId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<AdminMessage>()
|
||||
.HasOne(version => version.CreatedBy)
|
||||
|
||||
Reference in New Issue
Block a user