Foreign key for selected character slots.

This commit is contained in:
Pieter-Jan Briers
2020-10-07 10:35:38 +02:00
parent 0532811744
commit 20eac0de84
3 changed files with 25 additions and 6 deletions

View File

@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Content.Server.Database.Migrations.Postgres
{
[DbContext(typeof(PostgresServerDbContext))]
[Migration("20201006223000_SelectedCharacterSlotFk")]
public class SelectedCharacterSlotFk : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(@"ALTER TABLE preference
ADD CONSTRAINT ""FK_preference_profile_selected_character_slot_preference_id""
FOREIGN KEY (selected_character_slot, preference_id)
REFERENCES profile (slot, preference_id)
DEFERRABLE INITIALLY DEFERRED;");
}
}
}