mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Finalized client-side storage
This commit is contained in:
1 parent
6eefa733b4
commit
7773d377a2
29 files changed
+961
-434
No files matched your search
@@ -2,13 +2,17 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Folders")]
|
||||
internal class FolderEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual ICollection<FolderEntity> Folders { get; set; }
|
||||
public virtual ICollection<LayerEntity> Layers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Keypoints")]
|
||||
internal class KeypointEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Time { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
internal class Layer
|
||||
{
|
||||
public int ProfileId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public LayerType LayerType { get; set; }
|
||||
|
||||
public virtual Profile Profile { get; set; }
|
||||
public virtual ICollection<Layer> Layers { get; set; }
|
||||
}
|
||||
|
||||
internal enum LayerType
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Layers")]
|
||||
internal class LayerEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
|
||||
public virtual ICollection<LedEntity> Leds { get; set; }
|
||||
public virtual ICollection<LayerSettingEntity> Settings { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("LayerSettings")]
|
||||
internal class LayerSettingEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public ICollection<KeypointEntity> Keypoints { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Leds")]
|
||||
internal class LedEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string LedName { get; set; }
|
||||
public string LimitedToDevice { get; set; }
|
||||
|
||||
public int LayerId { get; set; }
|
||||
public virtual LayerEntity Layer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
internal class Profile
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public virtual ICollection<Layer> Layers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
internal class ProfileEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Module { get; set; }
|
||||
|
||||
public int RootFolderId { get; set; }
|
||||
public virtual FolderEntity RootFolder { get; set; }
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
internal class Setting
|
||||
internal class SettingEntity
|
||||
{
|
||||
[Key]
|
||||
public string Name { get; set; }
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -5,24 +5,12 @@ namespace Artemis.Storage
|
||||
{
|
||||
internal class StorageContext : DbContext
|
||||
{
|
||||
internal DbSet<Profile> Profiles { get; set; }
|
||||
internal DbSet<Setting> Settings { get; set; }
|
||||
internal DbSet<ProfileEntity> Profiles { get; set; }
|
||||
internal DbSet<SettingEntity> Settings { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite("Data Source=Storage.db");
|
||||
}
|
||||
|
||||
#region Overrides of DbContext
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Composite keys must be configured with fluent API in Core
|
||||
modelBuilder.Entity<Layer>().HasKey(l => new {l.ProfileId, l.Name});
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user