Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
GDPR stuff update (#18300)
Browse files Browse the repository at this point in the history
  • Loading branch information
PJB3005 authored Jul 26, 2023
1 parent 86f33a8 commit e0c4884
Show file tree
Hide file tree
Showing 9 changed files with 3,720 additions and 24 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated />
// <auto-generated />
using System;
using System.Net;
using System.Text.Json;
Expand Down Expand Up @@ -317,10 +317,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("character varying(4096)")
.HasColumnName("message");

b.Property<int>("Severity")
.HasColumnType("integer")
.HasColumnName("severity");

b.Property<Guid?>("PlayerUserId")
.HasColumnType("uuid")
.HasColumnName("player_user_id");
Expand All @@ -337,6 +333,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("boolean")
.HasColumnName("secret");

b.Property<int>("Severity")
.HasColumnType("integer")
.HasColumnName("severity");

b.HasKey("Id")
.HasName("PK_admin_notes");

Expand Down Expand Up @@ -1364,7 +1364,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.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")
Expand Down Expand Up @@ -1410,7 +1410,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.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")
Expand Down Expand Up @@ -1468,7 +1468,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.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")
Expand Down
Loading

0 comments on commit e0c4884

Please sign in to comment.