提交 0633a744 编写于 作者: 麦壳饼's avatar 麦壳饼

redefine datatable

上级 6cacccd9
......@@ -30,53 +30,7 @@ namespace IoTSharp.Hub.Data
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Customer>()
.HasOne(p => p.Tenant)
.WithMany(b => b.Customers);
modelBuilder.Entity<Device>()
.HasOne(p => p.Customer)
.WithMany(b => b.Devices);
//modelBuilder.Entity<KeyValueSharedSide>()
// .HasOne(p => p.Device )
// .WithMany(b => b.SharedSide);
//modelBuilder.Entity<KeyValueServerSide>()
// .HasOne(p => p.Device)
// .WithMany(b => b.ServerSide);
// modelBuilder.Entity<KeyValueClientSide>()
// .HasOne(p => p.Device)
// .WithMany(b=>b.ClientSide);
// modelBuilder.Entity<KevValueTelemetry>()
//.HasOne(p => p.Device)
//.WithMany(b => b.Telemetry);
// modelBuilder.Entity<KeyValueDeviceLatest>()
// .HasOne(p => p.Device)
// .WithMany(b => b.DeviceLatest);
// modelBuilder.Entity<Device>()
//.HasOne(p => p.Tenant)
//.WithMany(b => b.Devices);
// modelBuilder.Entity<Device>()
//.HasOne(p => p.Tenant)
//.WithMany(b => b.Devices);
modelBuilder.Entity<Relationship>()
.HasOne(p => p.Tenant);
modelBuilder.Entity<Relationship>()
.HasOne(p => p.Customer);
modelBuilder.Entity<Relationship>()
.HasOne(p => p.Identity);
switch (DatabaseType)
{
case DatabaseType.mssql:
......@@ -94,52 +48,65 @@ namespace IoTSharp.Hub.Data
private void ForNpgsql(ModelBuilder modelBuilder)
{
modelBuilder.Entity<KeyValueClientSide>()
modelBuilder.Entity<TelemetryData>()
.Property(b => b.Value_Json)
.HasColumnType("jsonb");
modelBuilder.Entity<KeyValueClientSide>()
modelBuilder.Entity<TelemetryData>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
modelBuilder.Entity<KeyValueServerSide>()
modelBuilder.Entity<AttributeLatest>()
.Property(b => b.Value_Json)
.HasColumnType("jsonb");
modelBuilder.Entity<KeyValueServerSide>()
modelBuilder.Entity<AttributeLatest>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
modelBuilder.Entity<KeyValueSharedSide>()
modelBuilder.Entity<AttributeData>()
.Property(b => b.Value_Json)
.HasColumnType("jsonb");
modelBuilder.Entity<KeyValueSharedSide>()
modelBuilder.Entity<AttributeData>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
modelBuilder.Entity<TelemetryLatest>()
.Property(b => b.Value_Json)
.HasColumnType("jsonb");
modelBuilder.Entity<TelemetryLatest>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
}
private void ForSqlServer(ModelBuilder modelBuilder)
{
modelBuilder.Entity<KeyValueClientSide>()
modelBuilder.Entity<TelemetryData>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
modelBuilder.Entity<KeyValueServerSide>()
modelBuilder.Entity<AttributeLatest>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
modelBuilder.Entity<KeyValueSharedSide>()
modelBuilder.Entity<AttributeData>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
modelBuilder.Entity<TelemetryLatest>()
.Property(b => b.Value_XML)
.HasColumnType("xml");
}
public DbSet<Tenant> Tenant { get; set; }
public DbSet<Customer> Customer { get; set; }
public DbSet<Relationship> Relationship { get; set; }
public DbSet<Device> Device { get; set; }
public DbSet<KeyValueClientSide> ClientSide { get; set; }
public DbSet<KeyValueServerSide> ServerSide { get; set; }
public DbSet<KeyValueSharedSide> SharedSide { get; set; }
public DbSet<KevValueTelemetry> TelemetryData { get; set; }
public DbSet<KeyValueDeviceLatest> DeviceLatest{ get; set; }
public DbSet<TelemetryData> TelemetryData { get; set; }
public DbSet<AttributeLatest> AttributeLatest { get; set; }
public DbSet<AttributeData> AttributeData { get; set; }
public DbSet<TelemetryLatest> TelemetryLatest { get; set; }
}
......
......@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace IoTSharp.Hub.Data
{
public class KeyValue
public class AttributeData
{
[Key]
public Guid Id { get; set; }
......@@ -12,7 +12,8 @@ namespace IoTSharp.Hub.Data
[Required]
[EnumDataType(typeof(DataType))]
public DataType Type { get; set; }
public DateTime DateTime { get; set; }
public bool Value_Boolean { get; set; }
public string Value_String { get; set; }
public long Value_Long { get; set; }
......
......@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace IoTSharp.Hub.Data
{
public class KeyValueDeviceLatest : KeyValueSharedSide
public class AttributeLatest : AttributeData
{
[Required]
[EnumDataType(typeof(KeyValueScope))]
......
......@@ -16,12 +16,11 @@ namespace IoTSharp.Hub.Data
public Tenant Tenant { get; set; }
public Customer Customer { get; set; }
public virtual List<KeyValueServerSide> ServerSide{ get; set; }
public virtual List<KeyValueSharedSide> SharedSide { get; set; }
public virtual List<KeyValueClientSide> ClientSide { get; set; }
public virtual List<KeyValueDeviceLatest> DeviceLatest { get; set; }
public virtual List<KevValueTelemetry> Telemetry { get; set; }
public virtual List<AttributeData> AttributeData { get; set; }
public virtual List<AttributeLatest> AttributeLatest { get; set; }
public virtual List<TelemetryData> TelemetryData { get; set; }
public virtual List<TelemetryLatest> TelemetryLatest { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace IoTSharp.Hub.Data
{
public class KeyValueClientSide : KeyValueSharedSide
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace IoTSharp.Hub.Data
{
public class KeyValueServerSide : KeyValueSharedSide
{
}
}
// <auto-generated />
using System;
using IoTSharp.Hub.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace IoTSharp.Hub.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20181228104739_ReDefineDataTable")]
partial class ReDefineDataTable
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateTime");
b.Property<Guid?>("DeviceId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("KeyName")
.IsRequired();
b.Property<int>("Type");
b.Property<byte[]>("Value_Binary");
b.Property<bool>("Value_Boolean");
b.Property<double>("Value_Double");
b.Property<string>("Value_Json")
.HasColumnType("jsonb");
b.Property<long>("Value_Long");
b.Property<string>("Value_String");
b.Property<string>("Value_XML")
.HasColumnType("xml");
b.HasKey("Id");
b.HasIndex("DeviceId");
b.ToTable("AttributeData");
b.HasDiscriminator<string>("Discriminator").HasValue("AttributeData");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address");
b.Property<string>("City");
b.Property<string>("Country");
b.Property<string>("Email");
b.Property<string>("Name");
b.Property<string>("Phone");
b.Property<string>("Province");
b.Property<string>("Street");
b.Property<Guid?>("TenantId");
b.Property<int>("ZipCode");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("Customer");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Device", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid?>("CustomerId");
b.Property<string>("Name");
b.Property<Guid?>("TenantId");
b.Property<string>("Type");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("TenantId");
b.ToTable("Device");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Relationship", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid?>("CustomerId");
b.Property<string>("IdentityId");
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("IdentityId");
b.HasIndex("TenantId");
b.ToTable("Relationship");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address");
b.Property<string>("City");
b.Property<string>("Country");
b.Property<string>("EMail");
b.Property<string>("Name");
b.Property<string>("Phone");
b.Property<string>("Province");
b.Property<string>("Street");
b.Property<int>("ZipCode");
b.HasKey("Id");
b.ToTable("Tenant");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeLatest", b =>
{
b.HasBaseType("IoTSharp.Hub.Data.AttributeData");
b.Property<Guid?>("DeviceId1");
b.Property<int>("Scope");
b.HasIndex("DeviceId1");
b.HasDiscriminator().HasValue("AttributeLatest");
});
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryData", b =>
{
b.HasBaseType("IoTSharp.Hub.Data.AttributeData");
b.Property<Guid>("DeviceId1")
.HasColumnName("TelemetryData_DeviceId1");
b.HasIndex("DeviceId1");
b.HasDiscriminator().HasValue("TelemetryData");
});
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryLatest", b =>
{
b.HasBaseType("IoTSharp.Hub.Data.AttributeData");
b.Property<Guid>("DeviceId1")
.HasColumnName("TelemetryLatest_DeviceId1");
b.HasIndex("DeviceId1");
b.HasDiscriminator().HasValue("TelemetryLatest");
});
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeData", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device")
.WithMany("AttributeData")
.HasForeignKey("DeviceId");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Customer", b =>
{
b.HasOne("IoTSharp.Hub.Data.Tenant", "Tenant")
.WithMany("Customers")
.HasForeignKey("TenantId");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Device", b =>
{
b.HasOne("IoTSharp.Hub.Data.Customer", "Customer")
.WithMany("Devices")
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Hub.Data.Tenant", "Tenant")
.WithMany("Devices")
.HasForeignKey("TenantId");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Relationship", b =>
{
b.HasOne("IoTSharp.Hub.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId");
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "Identity")
.WithMany()
.HasForeignKey("IdentityId");
b.HasOne("IoTSharp.Hub.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeLatest", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device")
.WithMany("AttributeLatest")
.HasForeignKey("DeviceId1");
});
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryData", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device", "Device")
.WithMany("TelemetryData")
.HasForeignKey("DeviceId1")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryLatest", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device", "Device")
.WithMany("TelemetryLatest")
.HasForeignKey("DeviceId1")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace IoTSharp.Hub.Data.Migrations
{
public partial class ReDefineDataTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SharedSide");
migrationBuilder.DropTable(
name: "TelemetryData");
migrationBuilder.CreateTable(
name: "AttributeData",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
KeyName = table.Column<string>(nullable: false),
Type = table.Column<int>(nullable: false),
DateTime = table.Column<DateTime>(nullable: false),
Value_Boolean = table.Column<bool>(nullable: false),
Value_String = table.Column<string>(nullable: true),
Value_Long = table.Column<long>(nullable: false),
Value_Double = table.Column<double>(nullable: false),
Value_Json = table.Column<string>(type: "jsonb", nullable: true),
Value_XML = table.Column<string>(type: "xml", nullable: true),
Value_Binary = table.Column<byte[]>(nullable: true),
DeviceId = table.Column<Guid>(nullable: true),
Discriminator = table.Column<string>(nullable: false),
Scope = table.Column<int>(nullable: true),
DeviceId1 = table.Column<Guid>(nullable: true),
TelemetryData_DeviceId1 = table.Column<Guid>(nullable: true),
TelemetryLatest_DeviceId1 = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AttributeData", x => x.Id);
table.ForeignKey(
name: "FK_AttributeData_Device_DeviceId",
column: x => x.DeviceId,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_AttributeData_Device_DeviceId1",
column: x => x.DeviceId1,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_AttributeData_Device_TelemetryData_DeviceId1",
column: x => x.TelemetryData_DeviceId1,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttributeData_Device_TelemetryLatest_DeviceId1",
column: x => x.TelemetryLatest_DeviceId1,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AttributeData_DeviceId",
table: "AttributeData",
column: "DeviceId");
migrationBuilder.CreateIndex(
name: "IX_AttributeData_DeviceId1",
table: "AttributeData",
column: "DeviceId1");
migrationBuilder.CreateIndex(
name: "IX_AttributeData_TelemetryData_DeviceId1",
table: "AttributeData",
column: "TelemetryData_DeviceId1");
migrationBuilder.CreateIndex(
name: "IX_AttributeData_TelemetryLatest_DeviceId1",
table: "AttributeData",
column: "TelemetryLatest_DeviceId1");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AttributeData");
migrationBuilder.CreateTable(
name: "SharedSide",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
DeviceId1 = table.Column<Guid>(nullable: false),
Discriminator = table.Column<string>(nullable: false),
KeyName = table.Column<string>(nullable: false),
Type = table.Column<int>(nullable: false),
Value_Binary = table.Column<byte[]>(nullable: true),
Value_Boolean = table.Column<bool>(nullable: false),
Value_Double = table.Column<double>(nullable: false),
Value_Json = table.Column<string>(type: "jsonb", nullable: true),
Value_Long = table.Column<long>(nullable: false),
Value_String = table.Column<string>(nullable: true),
Value_XML = table.Column<string>(type: "xml", nullable: true),
DeviceId = table.Column<Guid>(nullable: true),
KeyValueDeviceLatest_DeviceId = table.Column<Guid>(nullable: true),
Scope = table.Column<int>(nullable: true),
KeyValueServerSide_DeviceId = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SharedSide", x => x.Id);
table.ForeignKey(
name: "FK_SharedSide_Device_DeviceId",
column: x => x.DeviceId,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_SharedSide_Device_KeyValueDeviceLatest_DeviceId",
column: x => x.KeyValueDeviceLatest_DeviceId,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_SharedSide_Device_KeyValueServerSide_DeviceId",
column: x => x.KeyValueServerSide_DeviceId,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_SharedSide_Device_DeviceId1",
column: x => x.DeviceId1,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TelemetryData",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
DeviceId = table.Column<Guid>(nullable: false),
KeyName = table.Column<string>(nullable: false),
Type = table.Column<int>(nullable: false),
Value_Binary = table.Column<byte[]>(nullable: true),
Value_Boolean = table.Column<bool>(nullable: false),
Value_Double = table.Column<double>(nullable: false),
Value_Json = table.Column<string>(nullable: true),
Value_Long = table.Column<long>(nullable: false),
Value_String = table.Column<string>(nullable: true),
Value_XML = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TelemetryData", x => x.Id);
table.ForeignKey(
name: "FK_TelemetryData_Device_DeviceId",
column: x => x.DeviceId,
principalTable: "Device",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SharedSide_DeviceId",
table: "SharedSide",
column: "DeviceId");
migrationBuilder.CreateIndex(
name: "IX_SharedSide_KeyValueDeviceLatest_DeviceId",
table: "SharedSide",
column: "KeyValueDeviceLatest_DeviceId");
migrationBuilder.CreateIndex(
name: "IX_SharedSide_KeyValueServerSide_DeviceId",
table: "SharedSide",
column: "KeyValueServerSide_DeviceId");
migrationBuilder.CreateIndex(
name: "IX_SharedSide_DeviceId1",
table: "SharedSide",
column: "DeviceId1");
migrationBuilder.CreateIndex(
name: "IX_TelemetryData_DeviceId",
table: "TelemetryData",
column: "DeviceId");
}
}
}
......@@ -19,131 +19,100 @@ namespace IoTSharp.Hub.Data.Migrations
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("IoTSharp.Hub.Data.Customer", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address");
b.Property<string>("City");
b.Property<string>("Country");
b.Property<string>("Email");
b.Property<string>("Name");
b.Property<string>("Phone");
b.Property<string>("Province");
b.Property<DateTime>("DateTime");
b.Property<string>("Street");
b.Property<Guid?>("DeviceId");
b.Property<Guid?>("TenantId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<int>("ZipCode");
b.Property<string>("KeyName")
.IsRequired();
b.HasKey("Id");
b.Property<int>("Type");
b.HasIndex("TenantId");
b.Property<byte[]>("Value_Binary");
b.ToTable("Customer");
});
b.Property<bool>("Value_Boolean");
modelBuilder.Entity("IoTSharp.Hub.Data.Device", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<double>("Value_Double");
b.Property<Guid?>("CustomerId");
b.Property<string>("Value_Json")
.HasColumnType("jsonb");
b.Property<string>("Name");
b.Property<long>("Value_Long");
b.Property<Guid?>("TenantId");
b.Property<string>("Value_String");
b.Property<string>("Type");
b.Property<string>("Value_XML")
.HasColumnType("xml");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("DeviceId");
b.HasIndex("TenantId");
b.ToTable("AttributeData");
b.ToTable("Device");
b.HasDiscriminator<string>("Discriminator").HasValue("AttributeData");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KevValueTelemetry", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("DeviceId");
b.Property<string>("Address");
b.Property<string>("KeyName")
.IsRequired();
b.Property<string>("City");
b.Property<int>("Type");
b.Property<string>("Country");
b.Property<byte[]>("Value_Binary");
b.Property<string>("Email");
b.Property<bool>("Value_Boolean");
b.Property<string>("Name");
b.Property<double>("Value_Double");
b.Property<string>("Phone");
b.Property<string>("Value_Json");
b.Property<string>("Province");
b.Property<long>("Value_Long");
b.Property<string>("Street");
b.Property<string>("Value_String");
b.Property<Guid?>("TenantId");
b.Property<string>("Value_XML");
b.Property<int>("ZipCode");
b.HasKey("Id");
b.HasIndex("DeviceId");
b.HasIndex("TenantId");
b.ToTable("TelemetryData");
b.ToTable("Customer");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueSharedSide", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.Device", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("DeviceId1");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("KeyName")
.IsRequired();
b.Property<int>("Type");
b.Property<byte[]>("Value_Binary");
b.Property<bool>("Value_Boolean");
b.Property<double>("Value_Double");
b.Property<string>("Value_Json")
.HasColumnType("jsonb");
b.Property<Guid?>("CustomerId");
b.Property<long>("Value_Long");
b.Property<string>("Name");
b.Property<string>("Value_String");
b.Property<Guid?>("TenantId");
b.Property<string>("Value_XML")
.HasColumnType("xml");
b.Property<string>("Type");
b.HasKey("Id");
b.HasIndex("DeviceId1");
b.HasIndex("CustomerId");
b.ToTable("SharedSide");
b.HasIndex("TenantId");
b.HasDiscriminator<string>("Discriminator").HasValue("KeyValueSharedSide");
b.ToTable("Device");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Relationship", b =>
......@@ -357,41 +326,48 @@ namespace IoTSharp.Hub.Data.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueClientSide", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeLatest", b =>
{
b.HasBaseType("IoTSharp.Hub.Data.KeyValueSharedSide");
b.HasBaseType("IoTSharp.Hub.Data.AttributeData");
b.Property<Guid?>("DeviceId");
b.Property<Guid?>("DeviceId1");
b.HasIndex("DeviceId");
b.Property<int>("Scope");
b.HasDiscriminator().HasValue("KeyValueClientSide");
b.HasIndex("DeviceId1");
b.HasDiscriminator().HasValue("AttributeLatest");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueDeviceLatest", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryData", b =>
{
b.HasBaseType("IoTSharp.Hub.Data.KeyValueSharedSide");
b.Property<Guid?>("DeviceId")
.HasColumnName("KeyValueDeviceLatest_DeviceId");
b.HasBaseType("IoTSharp.Hub.Data.AttributeData");
b.Property<int>("Scope");
b.Property<Guid>("DeviceId1")
.HasColumnName("TelemetryData_DeviceId1");
b.HasIndex("DeviceId");
b.HasIndex("DeviceId1");
b.HasDiscriminator().HasValue("KeyValueDeviceLatest");
b.HasDiscriminator().HasValue("TelemetryData");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueServerSide", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryLatest", b =>
{
b.HasBaseType("IoTSharp.Hub.Data.KeyValueSharedSide");
b.HasBaseType("IoTSharp.Hub.Data.AttributeData");
b.Property<Guid?>("DeviceId")
.HasColumnName("KeyValueServerSide_DeviceId");
b.Property<Guid>("DeviceId1")
.HasColumnName("TelemetryLatest_DeviceId1");
b.HasIndex("DeviceId");
b.HasIndex("DeviceId1");
b.HasDiscriminator().HasValue("KeyValueServerSide");
b.HasDiscriminator().HasValue("TelemetryLatest");
});
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeData", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device")
.WithMany("AttributeData")
.HasForeignKey("DeviceId");
});
modelBuilder.Entity("IoTSharp.Hub.Data.Customer", b =>
......@@ -412,22 +388,6 @@ namespace IoTSharp.Hub.Data.Migrations
.HasForeignKey("TenantId");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KevValueTelemetry", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device", "Device")
.WithMany("Telemetry")
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueSharedSide", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device", "Device")
.WithMany("SharedSide")
.HasForeignKey("DeviceId1")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IoTSharp.Hub.Data.Relationship", b =>
{
b.HasOne("IoTSharp.Hub.Data.Customer", "Customer")
......@@ -488,25 +448,27 @@ namespace IoTSharp.Hub.Data.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueClientSide", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.AttributeLatest", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device")
.WithMany("ClientSide")
.HasForeignKey("DeviceId");
.WithMany("AttributeLatest")
.HasForeignKey("DeviceId1");
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueDeviceLatest", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryData", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device")
.WithMany("DeviceLatest")
.HasForeignKey("DeviceId");
b.HasOne("IoTSharp.Hub.Data.Device", "Device")
.WithMany("TelemetryData")
.HasForeignKey("DeviceId1")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IoTSharp.Hub.Data.KeyValueServerSide", b =>
modelBuilder.Entity("IoTSharp.Hub.Data.TelemetryLatest", b =>
{
b.HasOne("IoTSharp.Hub.Data.Device")
.WithMany("ServerSide")
.HasForeignKey("DeviceId");
b.HasOne("IoTSharp.Hub.Data.Device", "Device")
.WithMany("TelemetryLatest")
.HasForeignKey("DeviceId1")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
......
......@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace IoTSharp.Hub.Data
{
public class KevValueTelemetry : KeyValue
public class TelemetryData : AttributeData
{
[Required]
......
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace IoTSharp.Hub.Data
{
public class KeyValueSharedSide : KeyValue
public class TelemetryLatest : AttributeData
{
[Required]
[Required]
public Device Device { get; set; }
}
}
......@@ -116,9 +116,9 @@
<column name="NormalizedEmail" />
</index>
</table>
<table name="ClientSideAttribute" >
<table name="AttributeData" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
<column name="Name" type="text" decimal="0" jt="12" />
<column name="KeyName" type="text" decimal="0" jt="12" mandatory="y" />
<column name="Type" type="integer" length="10" decimal="0" jt="4" mandatory="y" />
<column name="Value_Boolean" type="bool" length="1" decimal="0" jt="-7" mandatory="y" />
<column name="Value_String" type="text" decimal="0" jt="12" />
......@@ -127,9 +127,40 @@
<column name="Value_Json" type="jsonb" decimal="0" jt="1111" />
<column name="Value_XML" type="xml" decimal="0" jt="2009" />
<column name="Value_Binary" type="bytea" decimal="0" jt="-2" />
<index name="PK_ClientSideAttribute" unique="PRIMARY_KEY" >
<column name="DeviceId" type="uuid" decimal="0" jt="1111" />
<column name="DateTime" type="timestamp" length="29" decimal="6" jt="93" mandatory="y" />
<column name="Discriminator" type="text" decimal="0" jt="12" mandatory="y" />
<column name="Scope" type="integer" length="10" decimal="0" jt="4" />
<column name="DeviceId1" type="uuid" decimal="0" jt="1111" />
<column name="TelemetryData_DeviceId1" type="uuid" decimal="0" jt="1111" />
<column name="TelemetryLatest_DeviceId1" type="uuid" decimal="0" jt="1111" />
<index name="PK_AttributeData" unique="PRIMARY_KEY" >
<column name="Id" />
</index>
<index name="IX_AttributeData_DeviceId" unique="NORMAL" >
<column name="DeviceId" />
</index>
<index name="IX_AttributeData_DeviceId1" unique="NORMAL" >
<column name="DeviceId1" />
</index>
<index name="IX_AttributeData_TelemetryData_DeviceId1" unique="NORMAL" >
<column name="TelemetryData_DeviceId1" />
</index>
<index name="IX_AttributeData_TelemetryLatest_DeviceId1" unique="NORMAL" >
<column name="TelemetryLatest_DeviceId1" />
</index>
<fk name="FK_AttributeData_Device_DeviceId" to_schema="public" to_table="Device" delete_action="restrict" >
<fk_column name="DeviceId" pk="Id" />
</fk>
<fk name="FK_AttributeData_Device_DeviceId1" to_schema="public" to_table="Device" delete_action="restrict" >
<fk_column name="DeviceId1" pk="Id" />
</fk>
<fk name="FK_AttributeData_Device_TelemetryData_DeviceId1" to_schema="public" to_table="Device" delete_action="cascade" >
<fk_column name="TelemetryData_DeviceId1" pk="Id" />
</fk>
<fk name="FK_AttributeData_Device_TelemetryLatest_DeviceId1" to_schema="public" to_table="Device" delete_action="cascade" >
<fk_column name="TelemetryLatest_DeviceId1" pk="Id" />
</fk>
</table>
<table name="Customer" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
......@@ -152,9 +183,6 @@
<fk name="FK_Customer_Tenant_TenantId" to_schema="public" to_table="Tenant" delete_action="restrict" >
<fk_column name="TenantId" pk="Id" />
</fk>
<fk name="fk_customer_relationship" to_schema="public" to_table="Relationship" >
<fk_column name="Id" pk="CustomerId" />
</fk>
</table>
<table name="Device" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
......@@ -179,48 +207,31 @@
</fk>
</table>
<table name="Relationship" >
<column name="UseId" type="uuid" decimal="0" jt="1111" mandatory="y" />
<column name="CustomerId" type="uuid" decimal="0" jt="1111" mandatory="y" />
<column name="TenantId" type="uuid" decimal="0" jt="1111" mandatory="y" />
<index name="PK_Relationship" unique="PRIMARY_KEY" >
<column name="UseId" />
</index>
<index name="unq_relationship_tenantid" unique="UNIQUE" >
<column name="CustomerId" type="uuid" decimal="0" jt="1111" />
<column name="TenantId" type="uuid" decimal="0" jt="1111" />
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
<column name="IdentityId" type="text" decimal="0" jt="12" />
<index name="IX_Relationship_TenantId" unique="NORMAL" >
<column name="TenantId" />
</index>
<index name="unq_relationship_customerid" unique="UNIQUE" >
<index name="IX_Relationship_CustomerId" unique="NORMAL" >
<column name="CustomerId" />
</index>
</table>
<table name="ServerSideAttribute" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
<column name="Name" type="text" decimal="0" jt="12" />
<column name="Type" type="integer" length="10" decimal="0" jt="4" mandatory="y" />
<column name="Value_Boolean" type="bool" length="1" decimal="0" jt="-7" mandatory="y" />
<column name="Value_String" type="text" decimal="0" jt="12" />
<column name="Value_Long" type="bigint" length="19" decimal="0" jt="-5" mandatory="y" />
<column name="Value_Double" type="float8" length="17" decimal="17" jt="6" mandatory="y" />
<column name="Value_Json" type="jsonb" decimal="0" jt="1111" />
<column name="Value_XML" type="xml" decimal="0" jt="2009" />
<column name="Value_Binary" type="bytea" decimal="0" jt="-2" />
<index name="PK_ServerSideAttribute" unique="PRIMARY_KEY" >
<index name="PK_Relationship" unique="PRIMARY_KEY" >
<column name="Id" />
</index>
</table>
<table name="SharedSideAttribute" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
<column name="Name" type="text" decimal="0" jt="12" />
<column name="Type" type="integer" length="10" decimal="0" jt="4" mandatory="y" />
<column name="Value_Boolean" type="bool" length="1" decimal="0" jt="-7" mandatory="y" />
<column name="Value_String" type="text" decimal="0" jt="12" />
<column name="Value_Long" type="bigint" length="19" decimal="0" jt="-5" mandatory="y" />
<column name="Value_Double" type="float8" length="17" decimal="17" jt="6" mandatory="y" />
<column name="Value_Json" type="jsonb" decimal="0" jt="1111" />
<column name="Value_XML" type="xml" decimal="0" jt="2009" />
<column name="Value_Binary" type="bytea" decimal="0" jt="-2" />
<index name="PK_SharedSideAttribute" unique="PRIMARY_KEY" >
<column name="Id" />
<index name="IX_Relationship_IdentityId" unique="NORMAL" >
<column name="IdentityId" />
</index>
<fk name="FK_Relationship_AspNetUsers_IdentityId" to_schema="public" to_table="AspNetUsers" delete_action="restrict" >
<fk_column name="IdentityId" pk="Id" />
</fk>
<fk name="FK_Relationship_Customer_CustomerId" to_schema="public" to_table="Customer" delete_action="restrict" >
<fk_column name="CustomerId" pk="Id" />
</fk>
<fk name="FK_Relationship_Tenant_TenantId" to_schema="public" to_table="Tenant" delete_action="restrict" >
<fk_column name="TenantId" pk="Id" />
</fk>
</table>
<table name="Tenant" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
......@@ -236,9 +247,6 @@
<index name="PK_Tenant" unique="PRIMARY_KEY" >
<column name="Id" />
</index>
<fk name="fk_tenant_relationship" to_schema="public" to_table="Relationship" >
<fk_column name="Id" pk="TenantId" />
</fk>
</table>
<table name="__EFMigrationsHistory" >
<column name="MigrationId" type="varchar" length="150" decimal="0" jt="12" mandatory="y" />
......@@ -252,21 +260,35 @@
</schema>
<connector name="PostgreSQL" database="PostgreSQL" driver_class="org.postgresql.Driver" driver_jar="postgresql-42.2.2.jar" driver_desc="Standard" host="localhost" port="5432" instance="IoTSharp" user="postgres" passwd="ZnV0dXJl" />
<layout name="Default Layout" id="Layout_159a766" show_relation="columns" >
<entity schema="public" name="AspNetRoles" color="BED3F4" x="464" y="48" />
<entity schema="public" name="AspNetUserLogins" color="BED3F4" x="288" y="400" />
<entity schema="public" name="Device" color="C7F4BE" x="1024" y="48" />
<entity schema="public" name="AspNetRoleClaims" color="BED3F4" x="672" y="48" />
<entity schema="public" name="Tenant" color="C7F4BE" x="1024" y="336" />
<entity schema="public" name="Customer" color="C7F4BE" x="880" y="48" />
<entity schema="public" name="__EFMigrationsHistory" color="F4DDBE" x="448" y="544" />
<entity schema="public" name="ClientSideAttribute" color="F4DDBE" x="672" y="544" />
<entity schema="public" name="ServerSideAttribute" color="F4DDBE" x="864" y="560" />
<entity schema="public" name="SharedSideAttribute" color="F4DDBE" x="1008" y="560" />
<entity schema="public" name="Relationship" color="F4DDBE" x="752" y="400" />
<entity schema="public" name="AspNetUsers" color="BED3F4" x="48" y="48" />
<entity schema="public" name="AspNetUserRoles" color="BED3F4" x="288" y="48" />
<entity schema="public" name="AspNetUserTokens" color="BED3F4" x="48" y="400" />
<entity schema="public" name="AspNetUserClaims" color="BED3F4" x="288" y="224" />
<entity schema="public" name="AspNetRoles" color="C7F4BE" x="1040" y="80" />
<entity schema="public" name="AspNetUserLogins" color="C7F4BE" x="864" y="432" />
<entity schema="public" name="AspNetRoleClaims" color="C7F4BE" x="1248" y="80" />
<entity schema="public" name="__EFMigrationsHistory" color="F4DDBE" x="624" y="768" />
<entity schema="public" name="AspNetUsers" color="C7F4BE" x="624" y="80" />
<entity schema="public" name="AspNetUserRoles" color="C7F4BE" x="864" y="80" />
<entity schema="public" name="AspNetUserTokens" color="C7F4BE" x="624" y="432" />
<entity schema="public" name="AspNetUserClaims" color="C7F4BE" x="864" y="256" />
<entity schema="public" name="Relationship" color="BED3F4" x="336" y="544" />
<entity schema="public" name="Customer" color="BED3F4" x="48" y="272" />
<entity schema="public" name="Tenant" color="BED3F4" x="192" y="272" />
<entity schema="public" name="Device" color="BED3F4" x="192" y="80" />
<entity schema="public" name="AttributeData" color="BED3F4" x="352" y="80" />
<group name="Device" color="ECF0F7" >
<entity schema="public" name="Device" />
<entity schema="public" name="Tenant" />
<entity schema="public" name="Customer" />
<entity schema="public" name="Relationship" />
<entity schema="public" name="AttributeData" />
</group>
<group name="AspNetUsers" color="EEF7EC" >
<entity schema="public" name="AspNetUsers" />
<entity schema="public" name="AspNetUserRoles" />
<entity schema="public" name="AspNetRoles" />
<entity schema="public" name="AspNetUserClaims" />
<entity schema="public" name="AspNetRoleClaims" />
<entity schema="public" name="AspNetUserLogins" />
<entity schema="public" name="AspNetUserTokens" />
</group>
</layout>
<layout name="Sample Layout with Tools" id="Layout_54786c0" show_column_type="y" show_relation="columns" >
<entity schema="public" name="AspNetRoleClaims" color="BED3F4" x="768" y="176" />
......@@ -276,12 +298,9 @@
<entity schema="public" name="AspNetUserRoles" color="BED3F4" x="336" y="176" />
<entity schema="public" name="AspNetUserTokens" color="BED3F4" x="48" y="528" />
<entity schema="public" name="AspNetUsers" color="BED3F4" x="48" y="176" />
<entity schema="public" name="ClientSideAttribute" color="F4DDBE" x="496" y="880" />
<entity schema="public" name="Customer" color="C7F4BE" x="976" y="176" />
<entity schema="public" name="Device" color="C7F4BE" x="1152" y="176" />
<entity schema="public" name="Relationship" color="F4DDBE" x="256" y="1024" />
<entity schema="public" name="ServerSideAttribute" color="F4DDBE" x="48" y="1024" />
<entity schema="public" name="SharedSideAttribute" color="F4DDBE" x="48" y="752" />
<entity schema="public" name="Tenant" color="C7F4BE" x="1152" y="464" />
<entity schema="public" name="__EFMigrationsHistory" color="F4DDBE" x="256" y="880" />
<callout x="48" y="80" pointer="NO" >
......@@ -308,10 +327,7 @@
</group>
<group name="__EFMigrationsHistory" color="F7F2EC" >
<entity schema="public" name="__EFMigrationsHistory" />
<entity schema="public" name="ClientSideAttribute" />
<entity schema="public" name="Relationship" />
<entity schema="public" name="ServerSideAttribute" />
<entity schema="public" name="SharedSideAttribute" />
</group>
<script name="Sample SQL Editor" id="Editor_40b3990" language="SQL" >
<string><![CDATA[SELECT *
......
......@@ -152,6 +152,9 @@
<fk name="FK_Customer_Tenant_TenantId" to_schema="public" to_table="Tenant" delete_action="restrict" >
<fk_column name="TenantId" pk="Id" />
</fk>
<fk name="fk_customer_relationship" to_schema="public" to_table="Relationship" >
<fk_column name="Id" pk="CustomerId" />
</fk>
</table>
<table name="Device" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
......@@ -182,6 +185,12 @@
<index name="PK_Relationship" unique="PRIMARY_KEY" >
<column name="UseId" />
</index>
<index name="unq_relationship_tenantid" unique="UNIQUE" >
<column name="TenantId" />
</index>
<index name="unq_relationship_customerid" unique="UNIQUE" >
<column name="CustomerId" />
</index>
</table>
<table name="ServerSideAttribute" >
<column name="Id" type="uuid" decimal="0" jt="1111" mandatory="y" />
......@@ -227,6 +236,9 @@
<index name="PK_Tenant" unique="PRIMARY_KEY" >
<column name="Id" />
</index>
<fk name="fk_tenant_relationship" to_schema="public" to_table="Relationship" >
<fk_column name="Id" pk="TenantId" />
</fk>
</table>
<table name="__EFMigrationsHistory" >
<column name="MigrationId" type="varchar" length="150" decimal="0" jt="12" mandatory="y" />
......@@ -240,21 +252,21 @@
</schema>
<connector name="PostgreSQL" database="PostgreSQL" driver_class="org.postgresql.Driver" driver_jar="postgresql-42.2.2.jar" driver_desc="Standard" host="localhost" port="5432" instance="IoTSharp" user="postgres" passwd="ZnV0dXJl" />
<layout name="Default Layout" id="Layout_159a766" show_relation="columns" >
<entity schema="public" name="AspNetRoleClaims" color="BED3F4" x="672" y="48" />
<entity schema="public" name="AspNetRoles" color="BED3F4" x="464" y="48" />
<entity schema="public" name="AspNetUserClaims" color="BED3F4" x="288" y="224" />
<entity schema="public" name="AspNetUserLogins" color="BED3F4" x="288" y="400" />
<entity schema="public" name="AspNetUserRoles" color="BED3F4" x="288" y="48" />
<entity schema="public" name="AspNetUserTokens" color="BED3F4" x="48" y="400" />
<entity schema="public" name="AspNetUsers" color="BED3F4" x="48" y="48" />
<entity schema="public" name="ClientSideAttribute" color="F4DDBE" x="432" y="752" />
<entity schema="public" name="Customer" color="C7F4BE" x="880" y="48" />
<entity schema="public" name="Device" color="C7F4BE" x="1024" y="48" />
<entity schema="public" name="Relationship" color="F4DDBE" x="240" y="896" />
<entity schema="public" name="ServerSideAttribute" color="F4DDBE" x="64" y="896" />
<entity schema="public" name="SharedSideAttribute" color="F4DDBE" x="48" y="624" />
<entity schema="public" name="AspNetRoleClaims" color="BED3F4" x="672" y="48" />
<entity schema="public" name="Tenant" color="C7F4BE" x="1024" y="336" />
<entity schema="public" name="__EFMigrationsHistory" color="F4DDBE" x="240" y="752" />
<entity schema="public" name="Customer" color="C7F4BE" x="880" y="48" />
<entity schema="public" name="__EFMigrationsHistory" color="F4DDBE" x="448" y="544" />
<entity schema="public" name="ClientSideAttribute" color="F4DDBE" x="672" y="544" />
<entity schema="public" name="ServerSideAttribute" color="F4DDBE" x="864" y="560" />
<entity schema="public" name="SharedSideAttribute" color="F4DDBE" x="1008" y="560" />
<entity schema="public" name="Relationship" color="F4DDBE" x="752" y="400" />
<entity schema="public" name="AspNetUsers" color="BED3F4" x="48" y="48" />
<entity schema="public" name="AspNetUserRoles" color="BED3F4" x="288" y="48" />
<entity schema="public" name="AspNetUserTokens" color="BED3F4" x="48" y="400" />
<entity schema="public" name="AspNetUserClaims" color="BED3F4" x="288" y="224" />
</layout>
<layout name="Sample Layout with Tools" id="Layout_54786c0" show_column_type="y" show_relation="columns" >
<entity schema="public" name="AspNetRoleClaims" color="BED3F4" x="768" y="176" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册