mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
206 lines
7.9 KiB
C#
206 lines
7.9 KiB
C#
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
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
FolderEntityId = table.Column<int>(nullable: true),
|
|
Name = table.Column<string>(nullable: true),
|
|
Order = table.Column<int>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Folders", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Folders_Folders_FolderEntityId",
|
|
column: x => x.FolderEntityId,
|
|
principalTable: "Folders",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Settings",
|
|
columns: table => new
|
|
{
|
|
Name = table.Column<string>(nullable: false),
|
|
Value = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Settings", x => x.Name);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Layers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
FolderEntityId = table.Column<int>(nullable: true),
|
|
Name = table.Column<string>(nullable: true),
|
|
Order = table.Column<int>(nullable: false),
|
|
Type = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Layers", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Layers_Folders_FolderEntityId",
|
|
column: x => x.FolderEntityId,
|
|
principalTable: "Folders",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Profiles",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Module = table.Column<string>(nullable: true),
|
|
Name = table.Column<string>(nullable: true),
|
|
RootFolderId = table.Column<int>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Profiles", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Profiles_Folders_RootFolderId",
|
|
column: x => x.RootFolderId,
|
|
principalTable: "Folders",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "LayerSettings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
LayerEntityId = table.Column<int>(nullable: true),
|
|
Name = table.Column<string>(nullable: true),
|
|
Value = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_LayerSettings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_LayerSettings_Layers_LayerEntityId",
|
|
column: x => x.LayerEntityId,
|
|
principalTable: "Layers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Leds",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
LayerId = table.Column<int>(nullable: false),
|
|
LedName = table.Column<string>(nullable: true),
|
|
LimitedToDevice = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Leds", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Leds_Layers_LayerId",
|
|
column: x => x.LayerId,
|
|
principalTable: "Layers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Keypoints",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
LayerSettingEntityId = table.Column<int>(nullable: true),
|
|
Time = table.Column<int>(nullable: false),
|
|
Value = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Keypoints", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Keypoints_LayerSettings_LayerSettingEntityId",
|
|
column: x => x.LayerSettingEntityId,
|
|
principalTable: "LayerSettings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Folders_FolderEntityId",
|
|
table: "Folders",
|
|
column: "FolderEntityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Keypoints_LayerSettingEntityId",
|
|
table: "Keypoints",
|
|
column: "LayerSettingEntityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Layers_FolderEntityId",
|
|
table: "Layers",
|
|
column: "FolderEntityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_LayerSettings_LayerEntityId",
|
|
table: "LayerSettings",
|
|
column: "LayerEntityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Leds_LayerId",
|
|
table: "Leds",
|
|
column: "LayerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Profiles_RootFolderId",
|
|
table: "Profiles",
|
|
column: "RootFolderId");
|
|
}
|
|
|
|
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");
|
|
}
|
|
}
|
|
}
|