using System; using Microsoft.EntityFrameworkCore.Migrations; 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), Order = table.Column(nullable: false), Name = table.Column(nullable: true), FolderEntityGuid = table.Column(nullable: true) }, 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: "PluginSettings", columns: table => new { PluginGuid = table.Column(nullable: false), Name = table.Column(nullable: false), Value = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_PluginSettings", x => new { x.Name, x.PluginGuid }); }); 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: "Surfaces", columns: table => new { Guid = table.Column(nullable: false), Name = table.Column(nullable: true), IsActive = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Surfaces", x => x.Guid); }); migrationBuilder.CreateTable( name: "Layers", columns: table => new { Guid = table.Column(nullable: false), Order = table.Column(nullable: false), Name = table.Column(nullable: true), FolderEntityGuid = table.Column(nullable: true) }, 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), PluginGuid = table.Column(nullable: false), Name = table.Column(nullable: true), RootFolderId = table.Column(nullable: false), RootFolderGuid = table.Column(nullable: true) }, 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: "DeviceEntity", columns: table => new { Guid = table.Column(nullable: false), DeviceHashCode = table.Column(nullable: false), X = table.Column(nullable: false), Y = table.Column(nullable: false), Rotation = table.Column(nullable: false), ZIndex = table.Column(nullable: false), SurfaceId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_DeviceEntity", x => x.Guid); table.ForeignKey( name: "FK_DeviceEntity_Surfaces_SurfaceId", column: x => x.SurfaceId, principalTable: "Surfaces", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "LayerSettings", columns: table => new { Guid = table.Column(nullable: false), Name = table.Column(nullable: true), Value = table.Column(nullable: true), LayerEntityGuid = 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), LedName = table.Column(nullable: true), LimitedToDevice = table.Column(nullable: true), LayerId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Leds", x => x.Guid); table.ForeignKey( name: "FK_Leds_Layers_LayerId", column: x => x.LayerId, principalTable: "Layers", principalColumn: "Guid", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Keypoints", columns: table => new { Guid = table.Column(nullable: false), Time = table.Column(nullable: false), Value = table.Column(nullable: true), LayerSettingEntityGuid = 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_DeviceEntity_SurfaceId", table: "DeviceEntity", column: "SurfaceId"); 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_LayerId", table: "Leds", column: "LayerId"); migrationBuilder.CreateIndex( name: "IX_Profiles_RootFolderGuid", table: "Profiles", column: "RootFolderGuid"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DeviceEntity"); migrationBuilder.DropTable( name: "Keypoints"); migrationBuilder.DropTable( name: "Leds"); migrationBuilder.DropTable( name: "PluginSettings"); migrationBuilder.DropTable( name: "Profiles"); migrationBuilder.DropTable( name: "Settings"); migrationBuilder.DropTable( name: "Surfaces"); migrationBuilder.DropTable( name: "LayerSettings"); migrationBuilder.DropTable( name: "Layers"); migrationBuilder.DropTable( name: "Folders"); } } }