Finalized client-side storage

This commit is contained in:
SpoinkyNL committed 2018-01-24 19:10:43 +01:00
1 parent 0c47b9a2fb
commit 4781524139
29 files changed
+961 -434

No files matched your search

@@ -1,67 +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 System;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
[Migration("20171208203331_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.1-rtm-125");
modelBuilder.Entity("Artemis.Storage.Entities.Layer", b =>
{
b.Property<int>("ProfileId");
b.Property<string>("Name");
b.HasKey("ProfileId", "Name");
b.ToTable("Layer");
});
modelBuilder.Entity("Artemis.Storage.Entities.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.HasKey("Id");
b.ToTable("Profiles");
});
modelBuilder.Entity("Artemis.Storage.Entities.Setting", b =>
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
b.Property<string>("Value");
b.HasKey("Name");
b.ToTable("Settings");
});
modelBuilder.Entity("Artemis.Storage.Entities.Layer", b =>
{
b.HasOne("Artemis.Storage.Entities.Profile", "Profile")
.WithMany("Layers")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
@@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Artemis.Storage.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
"Profiles",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(nullable: true)
},
constraints: table => { table.PrimaryKey("PK_Profiles", x => x.Id); });
migrationBuilder.CreateTable(
"Settings",
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(
"Layer",
table => new
{
ProfileId = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Layer", x => new {x.ProfileId, x.Name});
table.ForeignKey(
"FK_Layer_Profiles_ProfileId",
x => x.ProfileId,
"Profiles",
"Id",
onDelete: ReferentialAction.Cascade);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
"Layer");
migrationBuilder.DropTable(
"Settings");
migrationBuilder.DropTable(
"Profiles");
}
}
}
@@ -0,0 +1,190 @@
// <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 System;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
[Migration("20180124134310_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.1-rtm-125");
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("FolderEntityId");
b.Property<string>("Name");
b.Property<int>("Order");
b.HasKey("Id");
b.HasIndex("FolderEntityId");
b.ToTable("Folders");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("LayerSettingEntityId");
b.Property<int>("Time");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("LayerSettingEntityId");
b.ToTable("Keypoints");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("FolderEntityId");
b.Property<string>("Name");
b.Property<int>("Order");
b.Property<string>("Type");
b.HasKey("Id");
b.HasIndex("FolderEntityId");
b.ToTable("Layers");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("LayerEntityId");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("LayerEntityId");
b.ToTable("LayerSettings");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("LayerId");
b.Property<string>("LedName");
b.Property<string>("LimitedToDevice");
b.HasKey("Id");
b.HasIndex("LayerId");
b.ToTable("Leds");
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Module");
b.Property<string>("Name");
b.Property<int>("RootFolderId");
b.HasKey("Id");
b.HasIndex("RootFolderId");
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("FolderEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
.WithMany("Keypoints")
.HasForeignKey("LayerSettingEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Layers")
.HasForeignKey("FolderEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity")
.WithMany("Settings")
.HasForeignKey("LayerEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
.WithMany("Leds")
.HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
.WithMany()
.HasForeignKey("RootFolderId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,205 @@
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");
}
}
}
@@ -1,12 +1,16 @@
// <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 System;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
internal class StorageContextModelSnapshot : ModelSnapshot
partial class StorageContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
@@ -14,49 +18,172 @@ namespace Artemis.Storage.Migrations
modelBuilder
.HasAnnotation("ProductVersion", "2.0.1-rtm-125");
modelBuilder.Entity("Artemis.Storage.Entities.Layer", b =>
{
b.Property<int>("ProfileId");
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int?>("FolderEntityId");
b.HasKey("ProfileId", "Name");
b.Property<string>("Name");
b.ToTable("Layer");
});
b.Property<int>("Order");
modelBuilder.Entity("Artemis.Storage.Entities.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.HasKey("Id");
b.Property<string>("Name");
b.HasIndex("FolderEntityId");
b.HasKey("Id");
b.ToTable("Folders");
});
b.ToTable("Profiles");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
modelBuilder.Entity("Artemis.Storage.Entities.Setting", b =>
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
b.Property<int?>("LayerSettingEntityId");
b.Property<string>("Value");
b.Property<int>("Time");
b.HasKey("Name");
b.Property<string>("Value");
b.ToTable("Settings");
});
b.HasKey("Id");
modelBuilder.Entity("Artemis.Storage.Entities.Layer", b =>
{
b.HasOne("Artemis.Storage.Entities.Profile", "Profile")
.WithMany("Layers")
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade);
});
b.HasIndex("LayerSettingEntityId");
b.ToTable("Keypoints");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("FolderEntityId");
b.Property<string>("Name");
b.Property<int>("Order");
b.Property<string>("Type");
b.HasKey("Id");
b.HasIndex("FolderEntityId");
b.ToTable("Layers");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("LayerEntityId");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("LayerEntityId");
b.ToTable("LayerSettings");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("LayerId");
b.Property<string>("LedName");
b.Property<string>("LimitedToDevice");
b.HasKey("Id");
b.HasIndex("LayerId");
b.ToTable("Leds");
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Module");
b.Property<string>("Name");
b.Property<int>("RootFolderId");
b.HasKey("Id");
b.HasIndex("RootFolderId");
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("FolderEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
.WithMany("Keypoints")
.HasForeignKey("LayerSettingEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Layers")
.HasForeignKey("FolderEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity")
.WithMany("Settings")
.HasForeignKey("LayerEntityId");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
.WithMany("Leds")
.HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
.WithMany()
.HasForeignKey("RootFolderId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
}