From 54b7d3f22982a28c080973dbf90b2eb259cf6b59 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 18 Jan 2020 03:13:08 +0100 Subject: [PATCH] Commit EF migrations so the game starts again. --- .../20200118020532_initial.Designer.cs | 110 ++++++++++++++++++ .../Migrations/20200118020532_initial.cs | 74 ++++++++++++ .../PreferencesDbContextModelSnapshot.cs | 108 +++++++++++++++++ 3 files changed, 292 insertions(+) create mode 100644 Content.Server.Database/Migrations/20200118020532_initial.Designer.cs create mode 100644 Content.Server.Database/Migrations/20200118020532_initial.cs create mode 100644 Content.Server.Database/Migrations/PreferencesDbContextModelSnapshot.cs diff --git a/Content.Server.Database/Migrations/20200118020532_initial.Designer.cs b/Content.Server.Database/Migrations/20200118020532_initial.Designer.cs new file mode 100644 index 0000000000..9a592ee8d9 --- /dev/null +++ b/Content.Server.Database/Migrations/20200118020532_initial.Designer.cs @@ -0,0 +1,110 @@ +// +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 +{ + [DbContext(typeof(PreferencesDbContext))] + [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("HumanoidProfileId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Age") + .HasColumnType("INTEGER"); + + b.Property("CharacterName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("EyeColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FacialHairColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FacialHairName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HairColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HairName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrefsId") + .HasColumnType("INTEGER"); + + b.Property("Sex") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SkinColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Slot") + .HasColumnType("INTEGER"); + + b.Property("SlotName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("HumanoidProfileId"); + + b.HasIndex("PrefsId"); + + b.ToTable("HumanoidProfile"); + }); + + modelBuilder.Entity("Content.Server.Database.Prefs", b => + { + b.Property("PrefsId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("SelectedCharacterSlot") + .HasColumnType("INTEGER"); + + b.Property("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 + } + } +} diff --git a/Content.Server.Database/Migrations/20200118020532_initial.cs b/Content.Server.Database/Migrations/20200118020532_initial.cs new file mode 100644 index 0000000000..69fdb24764 --- /dev/null +++ b/Content.Server.Database/Migrations/20200118020532_initial.cs @@ -0,0 +1,74 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Content.Server.Database.Migrations +{ + public partial class initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Preferences", + columns: table => new + { + PrefsId = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Username = table.Column(nullable: false), + SelectedCharacterSlot = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Preferences", x => x.PrefsId); + }); + + migrationBuilder.CreateTable( + name: "HumanoidProfile", + columns: table => new + { + HumanoidProfileId = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slot = table.Column(nullable: false), + SlotName = table.Column(nullable: false), + CharacterName = table.Column(nullable: false), + Age = table.Column(nullable: false), + Sex = table.Column(nullable: false), + HairName = table.Column(nullable: false), + HairColor = table.Column(nullable: false), + FacialHairName = table.Column(nullable: false), + FacialHairColor = table.Column(nullable: false), + EyeColor = table.Column(nullable: false), + SkinColor = table.Column(nullable: false), + PrefsId = table.Column(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"); + } + } +} diff --git a/Content.Server.Database/Migrations/PreferencesDbContextModelSnapshot.cs b/Content.Server.Database/Migrations/PreferencesDbContextModelSnapshot.cs new file mode 100644 index 0000000000..5645bbe18c --- /dev/null +++ b/Content.Server.Database/Migrations/PreferencesDbContextModelSnapshot.cs @@ -0,0 +1,108 @@ +// +using Content.Server.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace Content.Server.Database.Migrations +{ + [DbContext(typeof(PreferencesDbContext))] + partial class PreferencesDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.0"); + + modelBuilder.Entity("Content.Server.Database.HumanoidProfile", b => + { + b.Property("HumanoidProfileId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Age") + .HasColumnType("INTEGER"); + + b.Property("CharacterName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("EyeColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FacialHairColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FacialHairName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HairColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HairName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrefsId") + .HasColumnType("INTEGER"); + + b.Property("Sex") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SkinColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Slot") + .HasColumnType("INTEGER"); + + b.Property("SlotName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("HumanoidProfileId"); + + b.HasIndex("PrefsId"); + + b.ToTable("HumanoidProfile"); + }); + + modelBuilder.Entity("Content.Server.Database.Prefs", b => + { + b.Property("PrefsId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("SelectedCharacterSlot") + .HasColumnType("INTEGER"); + + b.Property("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 + } + } +}