1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 10:13:30 +00:00
Artemis/src/Artemis.Storage/Migrations/20240308203921_Initial.cs
2024-03-08 21:44:28 +01:00

195 lines
8.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Artemis.Storage.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Devices",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
DeviceProvider = table.Column<string>(type: "TEXT", nullable: false),
X = table.Column<float>(type: "REAL", nullable: false),
Y = table.Column<float>(type: "REAL", nullable: false),
Rotation = table.Column<float>(type: "REAL", nullable: false),
Scale = table.Column<float>(type: "REAL", nullable: false),
ZIndex = table.Column<int>(type: "INTEGER", nullable: false),
RedScale = table.Column<float>(type: "REAL", nullable: false),
GreenScale = table.Column<float>(type: "REAL", nullable: false),
BlueScale = table.Column<float>(type: "REAL", nullable: false),
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
PhysicalLayout = table.Column<int>(type: "INTEGER", nullable: false),
LogicalLayout = table.Column<string>(type: "TEXT", nullable: true),
LayoutType = table.Column<string>(type: "TEXT", nullable: true),
LayoutParameter = table.Column<string>(type: "TEXT", nullable: true),
Categories = table.Column<string>(type: "TEXT", nullable: false),
InputIdentifiers = table.Column<string>(type: "TEXT", nullable: false),
InputMappings = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Devices", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Entries",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
EntryId = table.Column<long>(type: "INTEGER", nullable: false),
EntryType = table.Column<int>(type: "INTEGER", nullable: false),
Author = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
ReleaseId = table.Column<long>(type: "INTEGER", nullable: false),
ReleaseVersion = table.Column<string>(type: "TEXT", nullable: false),
InstalledAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
Metadata = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Entries", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Plugins",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Plugins", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PluginSettings",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
PluginGuid = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Value = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PluginSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProfileCategories",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
IsCollapsed = table.Column<bool>(type: "INTEGER", nullable: false),
IsSuspended = table.Column<bool>(type: "INTEGER", nullable: false),
Order = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProfileCategories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Releases",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Version = table.Column<string>(type: "TEXT", nullable: false),
InstalledAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Releases", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PluginFeatureEntity",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Type = table.Column<string>(type: "TEXT", nullable: false),
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
PluginEntityId = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PluginFeatureEntity", x => x.Id);
table.ForeignKey(
name: "FK_PluginFeatureEntity_Plugins_PluginEntityId",
column: x => x.PluginEntityId,
principalTable: "Plugins",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ProfileContainerEntity",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Icon = table.Column<byte[]>(type: "BLOB", nullable: false),
ProfileCategoryId = table.Column<Guid>(type: "TEXT", nullable: false),
ProfileConfiguration = table.Column<string>(type: "TEXT", nullable: false),
Profile = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProfileContainerEntity", x => x.Id);
table.ForeignKey(
name: "FK_ProfileContainerEntity_ProfileCategories_ProfileCategoryId",
column: x => x.ProfileCategoryId,
principalTable: "ProfileCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PluginFeatureEntity_PluginEntityId",
table: "PluginFeatureEntity",
column: "PluginEntityId");
migrationBuilder.CreateIndex(
name: "IX_ProfileContainerEntity_ProfileCategoryId",
table: "ProfileContainerEntity",
column: "ProfileCategoryId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Devices");
migrationBuilder.DropTable(
name: "Entries");
migrationBuilder.DropTable(
name: "PluginFeatureEntity");
migrationBuilder.DropTable(
name: "PluginSettings");
migrationBuilder.DropTable(
name: "ProfileContainerEntity");
migrationBuilder.DropTable(
name: "Releases");
migrationBuilder.DropTable(
name: "Plugins");
migrationBuilder.DropTable(
name: "ProfileCategories");
}
}
}