using Microsoft.EntityFrameworkCore.Migrations; using System; using System.Collections.Generic; namespace Artemis.Storage.Migrations { public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Folders", columns: table => new { Guid = table.Column(nullable: false), FolderEntityGuid = table.Column(nullable: true), Name = table.Column(nullable: true), Order = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Folders", x => x.Guid); table.ForeignKey( name: "FK_Folders_Folders_FolderEntityGuid", column: x => x.FolderEntityGuid, principalTable: "Folders", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Settings", columns: table => new { Name = table.Column(nullable: false), Value = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); }); migrationBuilder.CreateTable( name: "Layers", columns: table => new { Guid = table.Column(nullable: false), FolderEntityGuid = table.Column(nullable: true), Name = table.Column(nullable: true), Order = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Layers", x => x.Guid); table.ForeignKey( name: "FK_Layers_Folders_FolderEntityGuid", column: x => x.FolderEntityGuid, principalTable: "Folders", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Profiles", columns: table => new { Guid = table.Column(nullable: false), Name = table.Column(nullable: true), PluginGuid = table.Column(nullable: false), RootFolderGuid = table.Column(nullable: true), RootFolderId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Profiles", x => x.Guid); table.ForeignKey( name: "FK_Profiles_Folders_RootFolderGuid", column: x => x.RootFolderGuid, principalTable: "Folders", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "LayerSettings", columns: table => new { Guid = table.Column(nullable: false), LayerEntityGuid = table.Column(nullable: true), Name = table.Column(nullable: true), Value = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_LayerSettings", x => x.Guid); table.ForeignKey( name: "FK_LayerSettings_Layers_LayerEntityGuid", column: x => x.LayerEntityGuid, principalTable: "Layers", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Leds", columns: table => new { Guid = table.Column(nullable: false), LayerGuid = table.Column(nullable: true), LayerId = table.Column(nullable: false), LedName = table.Column(nullable: true), LimitedToDevice = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Leds", x => x.Guid); table.ForeignKey( name: "FK_Leds_Layers_LayerGuid", column: x => x.LayerGuid, principalTable: "Layers", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Keypoints", columns: table => new { Guid = table.Column(nullable: false), LayerSettingEntityGuid = table.Column(nullable: true), Time = table.Column(nullable: false), Value = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Keypoints", x => x.Guid); table.ForeignKey( name: "FK_Keypoints_LayerSettings_LayerSettingEntityGuid", column: x => x.LayerSettingEntityGuid, principalTable: "LayerSettings", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Folders_FolderEntityGuid", table: "Folders", column: "FolderEntityGuid"); migrationBuilder.CreateIndex( name: "IX_Keypoints_LayerSettingEntityGuid", table: "Keypoints", column: "LayerSettingEntityGuid"); migrationBuilder.CreateIndex( name: "IX_Layers_FolderEntityGuid", table: "Layers", column: "FolderEntityGuid"); migrationBuilder.CreateIndex( name: "IX_LayerSettings_LayerEntityGuid", table: "LayerSettings", column: "LayerEntityGuid"); migrationBuilder.CreateIndex( name: "IX_Leds_LayerGuid", table: "Leds", column: "LayerGuid"); migrationBuilder.CreateIndex( name: "IX_Profiles_RootFolderGuid", table: "Profiles", column: "RootFolderGuid"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Keypoints"); migrationBuilder.DropTable( name: "Leds"); migrationBuilder.DropTable( name: "Profiles"); migrationBuilder.DropTable( name: "Settings"); migrationBuilder.DropTable( name: "LayerSettings"); migrationBuilder.DropTable( name: "Layers"); migrationBuilder.DropTable( name: "Folders"); } } }