Added most of the settings code, doesn't work because SQLite is weird

This commit is contained in:
SpoinkyNL committed 2019-04-17 20:47:23 +02:00
1 parent 40c3222ae9
commit 8f4bb37fa4
42 files changed
+409 -582

No files matched your search

@@ -1,191 +0,0 @@
// <auto-generated />
using Artemis.Storage;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
[Migration("20180406175247_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("FolderEntityGuid");
b.Property<string>("Name");
b.Property<int>("Order");
b.HasKey("Guid");
b.HasIndex("FolderEntityGuid");
b.ToTable("Folders");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("LayerSettingEntityGuid");
b.Property<int>("Time");
b.Property<string>("Value");
b.HasKey("Guid");
b.HasIndex("LayerSettingEntityGuid");
b.ToTable("Keypoints");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("FolderEntityGuid");
b.Property<string>("Name");
b.Property<int>("Order");
b.HasKey("Guid");
b.HasIndex("FolderEntityGuid");
b.ToTable("Layers");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("LayerEntityGuid");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("Guid");
b.HasIndex("LayerEntityGuid");
b.ToTable("LayerSettings");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("LayerGuid");
b.Property<int>("LayerId");
b.Property<string>("LedName");
b.Property<string>("LimitedToDevice");
b.HasKey("Guid");
b.HasIndex("LayerGuid");
b.ToTable("Leds");
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<Guid>("PluginGuid");
b.Property<string>("RootFolderGuid");
b.Property<int>("RootFolderId");
b.HasKey("Guid");
b.HasIndex("RootFolderGuid");
b.ToTable("Profiles");
});
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
b.Property<string>("Value");
b.HasKey("Name");
b.ToTable("Settings");
});
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Folders")
.HasForeignKey("FolderEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
.WithMany("Keypoints")
.HasForeignKey("LayerSettingEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Layers")
.HasForeignKey("FolderEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity")
.WithMany("Settings")
.HasForeignKey("LayerEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
.WithMany("Leds")
.HasForeignKey("LayerGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
.WithMany()
.HasForeignKey("RootFolderGuid");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,196 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Artemis.Storage.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
"Folders",
table => new
{
Guid = table.Column<string>(),
FolderEntityGuid = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Order = table.Column<int>()
},
constraints: table =>
{
table.PrimaryKey("PK_Folders", x => x.Guid);
table.ForeignKey(
"FK_Folders_Folders_FolderEntityGuid",
x => x.FolderEntityGuid,
"Folders",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
"Settings",
table => new
{
Name = table.Column<string>(),
Value = table.Column<string>(nullable: true)
},
constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); });
migrationBuilder.CreateTable(
"Layers",
table => new
{
Guid = table.Column<string>(),
FolderEntityGuid = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Order = table.Column<int>()
},
constraints: table =>
{
table.PrimaryKey("PK_Layers", x => x.Guid);
table.ForeignKey(
"FK_Layers_Folders_FolderEntityGuid",
x => x.FolderEntityGuid,
"Folders",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
"Profiles",
table => new
{
Guid = table.Column<string>(),
Name = table.Column<string>(nullable: true),
PluginGuid = table.Column<Guid>(),
RootFolderGuid = table.Column<string>(nullable: true),
RootFolderId = table.Column<int>()
},
constraints: table =>
{
table.PrimaryKey("PK_Profiles", x => x.Guid);
table.ForeignKey(
"FK_Profiles_Folders_RootFolderGuid",
x => x.RootFolderGuid,
"Folders",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
"LayerSettings",
table => new
{
Guid = table.Column<string>(),
LayerEntityGuid = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LayerSettings", x => x.Guid);
table.ForeignKey(
"FK_LayerSettings_Layers_LayerEntityGuid",
x => x.LayerEntityGuid,
"Layers",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
"Leds",
table => new
{
Guid = table.Column<string>(),
LayerGuid = table.Column<string>(nullable: true),
LayerId = table.Column<int>(),
LedName = table.Column<string>(nullable: true),
LimitedToDevice = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Leds", x => x.Guid);
table.ForeignKey(
"FK_Leds_Layers_LayerGuid",
x => x.LayerGuid,
"Layers",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
"Keypoints",
table => new
{
Guid = table.Column<string>(),
LayerSettingEntityGuid = table.Column<string>(nullable: true),
Time = table.Column<int>(),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Keypoints", x => x.Guid);
table.ForeignKey(
"FK_Keypoints_LayerSettings_LayerSettingEntityGuid",
x => x.LayerSettingEntityGuid,
"LayerSettings",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
"IX_Folders_FolderEntityGuid",
"Folders",
"FolderEntityGuid");
migrationBuilder.CreateIndex(
"IX_Keypoints_LayerSettingEntityGuid",
"Keypoints",
"LayerSettingEntityGuid");
migrationBuilder.CreateIndex(
"IX_Layers_FolderEntityGuid",
"Layers",
"FolderEntityGuid");
migrationBuilder.CreateIndex(
"IX_LayerSettings_LayerEntityGuid",
"LayerSettings",
"LayerEntityGuid");
migrationBuilder.CreateIndex(
"IX_Leds_LayerGuid",
"Leds",
"LayerGuid");
migrationBuilder.CreateIndex(
"IX_Profiles_RootFolderGuid",
"Profiles",
"RootFolderGuid");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
"Keypoints");
migrationBuilder.DropTable(
"Leds");
migrationBuilder.DropTable(
"Profiles");
migrationBuilder.DropTable(
"Settings");
migrationBuilder.DropTable(
"LayerSettings");
migrationBuilder.DropTable(
"Layers");
migrationBuilder.DropTable(
"Folders");
}
}
}
@@ -1,33 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Artemis.Storage.Migrations
{
public partial class SettingsPluginGuid : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PluginGuid",
table: "Settings",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.CreateIndex(
name: "IX_Settings_Name_PluginGuid",
table: "Settings",
columns: new[] { "Name", "PluginGuid" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Settings_Name_PluginGuid",
table: "Settings");
migrationBuilder.DropColumn(
name: "PluginGuid",
table: "Settings");
}
}
}
@@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
[Migration("20190415185618_SettingsPluginGuid")]
partial class SettingsPluginGuid
[Migration("20190417180145_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@@ -132,16 +132,13 @@ namespace Artemis.Storage.Migrations
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<Guid>("PluginGuid");
b.Property<string>("Value");
b.HasKey("Name");
b.HasIndex("Name", "PluginGuid");
b.HasKey("Name", "PluginGuid");
b.ToTable("Settings");
});
@@ -0,0 +1,200 @@
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<string>(nullable: false),
Order = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: true),
FolderEntityGuid = table.Column<string>(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: "Settings",
columns: table => new
{
PluginGuid = table.Column<Guid>(nullable: false),
Name = table.Column<string>(nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => new { x.Name, x.PluginGuid });
});
migrationBuilder.CreateTable(
name: "Layers",
columns: table => new
{
Guid = table.Column<string>(nullable: false),
Order = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: true),
FolderEntityGuid = table.Column<string>(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<string>(nullable: false),
PluginGuid = table.Column<Guid>(nullable: false),
Name = table.Column<string>(nullable: true),
RootFolderId = table.Column<int>(nullable: false),
RootFolderGuid = table.Column<string>(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: "LayerSettings",
columns: table => new
{
Guid = table.Column<string>(nullable: false),
Name = table.Column<string>(nullable: true),
Value = table.Column<string>(nullable: true),
LayerEntityGuid = table.Column<string>(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<string>(nullable: false),
LedName = table.Column<string>(nullable: true),
LimitedToDevice = table.Column<string>(nullable: true),
LayerId = table.Column<int>(nullable: false),
LayerGuid = table.Column<string>(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<string>(nullable: false),
Time = table.Column<int>(nullable: false),
Value = table.Column<string>(nullable: true),
LayerSettingEntityGuid = table.Column<string>(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");
}
}
}
@@ -130,16 +130,13 @@ namespace Artemis.Storage.Migrations
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<Guid>("PluginGuid");
b.Property<string>("Value");
b.HasKey("Name");
b.HasIndex("Name", "PluginGuid");
b.HasKey("Name", "PluginGuid");
b.ToTable("Settings");
});