Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
a23ad6b9
IoTSharp
项目概览
IoTSharp
/
IoTSharp
10 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a23ad6b9
编写于
9月 14, 2022
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整了 sqlite和pgsql 关于产品 索引问题。
上级
be8f9c6b
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
58 addition
and
2761 deletion
+58
-2761
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/20220914112335_Produce.Designer.cs
....PostgreSQL/Migrations/20220914112335_Produce.Designer.cs
+6
-5
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/20220914112335_Produce.cs
...harp.Data.PostgreSQL/Migrations/20220914112335_Produce.cs
+17
-8
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs
...ostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs
+5
-4
IoTSharp.Data.Storage/IoTSharp.Data.SqlServer/Migrations/20220913060334_Produce.Designer.cs
...a.SqlServer/Migrations/20220913060334_Produce.Designer.cs
+0
-2533
IoTSharp.Data.Storage/IoTSharp.Data.SqlServer/Migrations/20220913060334_Produce.cs
...Sharp.Data.SqlServer/Migrations/20220913060334_Produce.cs
+0
-107
IoTSharp.Data.Storage/IoTSharp.Data.SqlServer/Migrations/ApplicationDbContextModelSnapshot.cs
...SqlServer/Migrations/ApplicationDbContextModelSnapshot.cs
+1
-85
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/20220914122629_Produce.Designer.cs
...Data.Sqlite/Migrations/20220914122629_Produce.Designer.cs
+6
-5
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/20220914122629_Produce.cs
...IoTSharp.Data.Sqlite/Migrations/20220914122629_Produce.cs
+17
-8
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs
...ta.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs
+5
-4
IoTSharp.Data/ApplicationDbContext.cs
IoTSharp.Data/ApplicationDbContext.cs
+1
-2
未找到文件。
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/2022091
3055638
_Produce.Designer.cs
→
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/2022091
4112335
_Produce.Designer.cs
浏览文件 @
a23ad6b9
...
...
@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace
IoTSharp.Migrations
{
[
DbContext
(
typeof
(
ApplicationDbContext
))]
[
Migration
(
"2022091
3055638
_Produce"
)]
[
Migration
(
"2022091
4112335
_Produce"
)]
partial
class
Produce
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
...
...
@@ -1990,7 +1990,10 @@ namespace IoTSharp.Migrations
{
b
.
HasBaseType
(
"IoTSharp.Data.DataStorage"
);
b
.
HasIndex
(
"DeviceId"
);
b
.
Property
<
Guid
?>(
"OwnerId"
)
.
HasColumnType
(
"uuid"
);
b
.
HasIndex
(
"OwnerId"
);
b
.
HasDiscriminator
().
HasValue
(
5
);
});
...
...
@@ -2475,9 +2478,7 @@ namespace IoTSharp.Migrations
{
b
.
HasOne
(
"IoTSharp.Data.Produce"
,
"Owner"
)
.
WithMany
(
"DefaultAttributes"
)
.
HasForeignKey
(
"DeviceId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
.
HasForeignKey
(
"OwnerId"
);
b
.
Navigation
(
"Owner"
);
});
...
...
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/2022091
3055638
_Produce.cs
→
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/2022091
4112335
_Produce.cs
浏览文件 @
a23ad6b9
...
...
@@ -15,6 +15,12 @@ namespace IoTSharp.Migrations
type
:
"uuid"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
Guid
>(
name
:
"OwnerId"
,
table
:
"DataStorage"
,
type
:
"uuid"
,
nullable
:
true
);
migrationBuilder
.
CreateTable
(
name
:
"Produce"
,
columns
:
table
=>
new
...
...
@@ -48,9 +54,9 @@ namespace IoTSharp.Migrations
column
:
"ProduceId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DataStorage_
Device
Id"
,
name
:
"IX_DataStorage_
Owner
Id"
,
table
:
"DataStorage"
,
column
:
"
Device
Id"
);
column
:
"
Owner
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Produce_CustomerId"
,
...
...
@@ -63,12 +69,11 @@ namespace IoTSharp.Migrations
column
:
"TenantId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_DataStorage_Produce_
Device
Id"
,
name
:
"FK_DataStorage_Produce_
Owner
Id"
,
table
:
"DataStorage"
,
column
:
"
Device
Id"
,
column
:
"
Owner
Id"
,
principalTable
:
"Produce"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
principalColumn
:
"Id"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Device_Produce_ProduceId"
,
...
...
@@ -81,7 +86,7 @@ namespace IoTSharp.Migrations
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_DataStorage_Produce_
Device
Id"
,
name
:
"FK_DataStorage_Produce_
Owner
Id"
,
table
:
"DataStorage"
);
migrationBuilder
.
DropForeignKey
(
...
...
@@ -96,12 +101,16 @@ namespace IoTSharp.Migrations
table
:
"Device"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_DataStorage_
Device
Id"
,
name
:
"IX_DataStorage_
Owner
Id"
,
table
:
"DataStorage"
);
migrationBuilder
.
DropColumn
(
name
:
"ProduceId"
,
table
:
"Device"
);
migrationBuilder
.
DropColumn
(
name
:
"OwnerId"
,
table
:
"DataStorage"
);
}
}
}
IoTSharp.Data.Storage/IoTSharp.Data.PostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs
浏览文件 @
a23ad6b9
...
...
@@ -1988,7 +1988,10 @@ namespace IoTSharp.Migrations
{
b
.
HasBaseType
(
"IoTSharp.Data.DataStorage"
);
b
.
HasIndex
(
"DeviceId"
);
b
.
Property
<
Guid
?>(
"OwnerId"
)
.
HasColumnType
(
"uuid"
);
b
.
HasIndex
(
"OwnerId"
);
b
.
HasDiscriminator
().
HasValue
(
5
);
});
...
...
@@ -2473,9 +2476,7 @@ namespace IoTSharp.Migrations
{
b
.
HasOne
(
"IoTSharp.Data.Produce"
,
"Owner"
)
.
WithMany
(
"DefaultAttributes"
)
.
HasForeignKey
(
"DeviceId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
.
HasForeignKey
(
"OwnerId"
);
b
.
Navigation
(
"Owner"
);
});
...
...
IoTSharp.Data.Storage/IoTSharp.Data.SqlServer/Migrations/20220913060334_Produce.Designer.cs
已删除
100644 → 0
浏览文件 @
be8f9c6b
此差异已折叠。
点击以展开。
IoTSharp.Data.Storage/IoTSharp.Data.SqlServer/Migrations/20220913060334_Produce.cs
已删除
100644 → 0
浏览文件 @
be8f9c6b
using
System
;
using
Microsoft.EntityFrameworkCore.Migrations
;
#
nullable
disable
namespace
IoTSharp.Data.SqlServer.Migrations
{
public
partial
class
Produce
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AddColumn
<
Guid
>(
name
:
"ProduceId"
,
table
:
"Device"
,
type
:
"uniqueidentifier"
,
nullable
:
true
);
migrationBuilder
.
CreateTable
(
name
:
"Produce"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
Guid
>(
type
:
"uniqueidentifier"
,
nullable
:
false
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
DefaultTimeout
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
TenantId
=
table
.
Column
<
Guid
>(
type
:
"uniqueidentifier"
,
nullable
:
true
),
CustomerId
=
table
.
Column
<
Guid
>(
type
:
"uniqueidentifier"
,
nullable
:
true
),
DefaultIdentityType
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Produce"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Produce_Customer_CustomerId"
,
column
:
x
=>
x
.
CustomerId
,
principalTable
:
"Customer"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_Produce_Tenant_TenantId"
,
column
:
x
=>
x
.
TenantId
,
principalTable
:
"Tenant"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Device_ProduceId"
,
table
:
"Device"
,
column
:
"ProduceId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DataStorage_DeviceId"
,
table
:
"DataStorage"
,
column
:
"DeviceId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Produce_CustomerId"
,
table
:
"Produce"
,
column
:
"CustomerId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Produce_TenantId"
,
table
:
"Produce"
,
column
:
"TenantId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_DataStorage_Produce_DeviceId"
,
table
:
"DataStorage"
,
column
:
"DeviceId"
,
principalTable
:
"Produce"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Device_Produce_ProduceId"
,
table
:
"Device"
,
column
:
"ProduceId"
,
principalTable
:
"Produce"
,
principalColumn
:
"Id"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_DataStorage_Produce_DeviceId"
,
table
:
"DataStorage"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Device_Produce_ProduceId"
,
table
:
"Device"
);
migrationBuilder
.
DropTable
(
name
:
"Produce"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Device_ProduceId"
,
table
:
"Device"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_DataStorage_DeviceId"
,
table
:
"DataStorage"
);
migrationBuilder
.
DropColumn
(
name
:
"ProduceId"
,
table
:
"Device"
);
}
}
}
IoTSharp.Data.Storage/IoTSharp.Data.SqlServer/Migrations/ApplicationDbContextModelSnapshot.cs
浏览文件 @
a23ad6b9
...
...
@@ -17,7 +17,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"6.0.
8
"
)
.
HasAnnotation
(
"ProductVersion"
,
"6.0.
3
"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
);
SqlServerModelBuilderExtensions
.
UseIdentityColumns
(
modelBuilder
,
1L
,
1
);
...
...
@@ -606,9 +606,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b
.
Property
<
Guid
?>(
"OwnerId"
)
.
HasColumnType
(
"uniqueidentifier"
);
b
.
Property
<
Guid
?>(
"ProduceId"
)
.
HasColumnType
(
"uniqueidentifier"
);
b
.
Property
<
int
>(
"Status"
)
.
HasColumnType
(
"int"
);
...
...
@@ -628,8 +625,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b
.
HasIndex
(
"OwnerId"
);
b
.
HasIndex
(
"ProduceId"
);
b
.
HasIndex
(
"TenantId"
);
b
.
ToTable
(
"Device"
);
...
...
@@ -1448,39 +1443,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b
.
ToTable
(
"FlowRules"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.Produce"
,
b
=>
{
b
.
Property
<
Guid
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"uniqueidentifier"
);
b
.
Property
<
Guid
?>(
"CustomerId"
)
.
HasColumnType
(
"uniqueidentifier"
);
b
.
Property
<
int
>(
"DefaultIdentityType"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"DefaultTimeout"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
Guid
?>(
"TenantId"
)
.
HasColumnType
(
"uniqueidentifier"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
HasIndex
(
"TenantId"
);
b
.
ToTable
(
"Produce"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.RefreshToken"
,
b
=>
{
b
.
Property
<
Guid
>(
"Id"
)
...
...
@@ -1986,15 +1948,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b
.
HasDiscriminator
().
HasValue
(
1
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.ProduceData"
,
b
=>
{
b
.
HasBaseType
(
"IoTSharp.Data.DataStorage"
);
b
.
HasIndex
(
"DeviceId"
);
b
.
HasDiscriminator
().
HasValue
(
5
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.TelemetryLatest"
,
b
=>
{
b
.
HasBaseType
(
"IoTSharp.Data.DataStorage"
);
...
...
@@ -2117,10 +2070,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
.
WithMany
(
"Children"
)
.
HasForeignKey
(
"OwnerId"
);
b
.
HasOne
(
"IoTSharp.Data.Produce"
,
null
)
.
WithMany
(
"Devices"
)
.
HasForeignKey
(
"ProduceId"
);
b
.
HasOne
(
"IoTSharp.Data.Tenant"
,
"Tenant"
)
.
WithMany
(
"Devices"
)
.
HasForeignKey
(
"TenantId"
);
...
...
@@ -2330,21 +2279,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b
.
Navigation
(
"Tenant"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.Produce"
,
b
=>
{
b
.
HasOne
(
"IoTSharp.Data.Customer"
,
"Customer"
)
.
WithMany
()
.
HasForeignKey
(
"CustomerId"
);
b
.
HasOne
(
"IoTSharp.Data.Tenant"
,
"Tenant"
)
.
WithMany
()
.
HasForeignKey
(
"TenantId"
);
b
.
Navigation
(
"Customer"
);
b
.
Navigation
(
"Tenant"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.RefreshToken"
,
b
=>
{
b
.
HasOne
(
"Microsoft.AspNetCore.Identity.IdentityUser"
,
"User"
)
...
...
@@ -2471,17 +2405,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
.
IsRequired
();
});
modelBuilder
.
Entity
(
"IoTSharp.Data.ProduceData"
,
b
=>
{
b
.
HasOne
(
"IoTSharp.Data.Produce"
,
"Owner"
)
.
WithMany
(
"DefaultAttributes"
)
.
HasForeignKey
(
"DeviceId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Owner"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.Asset"
,
b
=>
{
b
.
Navigation
(
"OwnedAssets"
);
...
...
@@ -2507,13 +2430,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b
.
Navigation
(
"DeviceModelCommands"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.Produce"
,
b
=>
{
b
.
Navigation
(
"DefaultAttributes"
);
b
.
Navigation
(
"Devices"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.Tenant"
,
b
=>
{
b
.
Navigation
(
"Customers"
);
...
...
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/2022091
3060035
_Produce.Designer.cs
→
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/2022091
4122629
_Produce.Designer.cs
浏览文件 @
a23ad6b9
...
...
@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace
IoTSharp.Data.Sqlite.Migrations
{
[
DbContext
(
typeof
(
ApplicationDbContext
))]
[
Migration
(
"2022091
3060035
_Produce"
)]
[
Migration
(
"2022091
4122629
_Produce"
)]
partial
class
Produce
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
...
...
@@ -2193,7 +2193,10 @@ namespace IoTSharp.Data.Sqlite.Migrations
{
b
.
HasBaseType
(
"IoTSharp.Data.DataStorage"
);
b
.
HasIndex
(
"DeviceId"
);
b
.
Property
<
Guid
?>(
"OwnerId"
)
.
HasColumnType
(
"TEXT"
);
b
.
HasIndex
(
"OwnerId"
);
b
.
HasDiscriminator
().
HasValue
(
5
);
});
...
...
@@ -2678,9 +2681,7 @@ namespace IoTSharp.Data.Sqlite.Migrations
{
b
.
HasOne
(
"IoTSharp.Data.Produce"
,
"Owner"
)
.
WithMany
(
"DefaultAttributes"
)
.
HasForeignKey
(
"DeviceId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
.
HasForeignKey
(
"OwnerId"
);
b
.
Navigation
(
"Owner"
);
});
...
...
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/2022091
3060035
_Produce.cs
→
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/2022091
4122629
_Produce.cs
浏览文件 @
a23ad6b9
...
...
@@ -15,6 +15,12 @@ namespace IoTSharp.Data.Sqlite.Migrations
type
:
"TEXT"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
Guid
>(
name
:
"OwnerId"
,
table
:
"DataStorage"
,
type
:
"TEXT"
,
nullable
:
true
);
migrationBuilder
.
CreateTable
(
name
:
"Produce"
,
columns
:
table
=>
new
...
...
@@ -48,9 +54,9 @@ namespace IoTSharp.Data.Sqlite.Migrations
column
:
"ProduceId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DataStorage_
Device
Id"
,
name
:
"IX_DataStorage_
Owner
Id"
,
table
:
"DataStorage"
,
column
:
"
Device
Id"
);
column
:
"
Owner
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Produce_CustomerId"
,
...
...
@@ -63,12 +69,11 @@ namespace IoTSharp.Data.Sqlite.Migrations
column
:
"TenantId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_DataStorage_Produce_
Device
Id"
,
name
:
"FK_DataStorage_Produce_
Owner
Id"
,
table
:
"DataStorage"
,
column
:
"
Device
Id"
,
column
:
"
Owner
Id"
,
principalTable
:
"Produce"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
principalColumn
:
"Id"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Device_Produce_ProduceId"
,
...
...
@@ -81,7 +86,7 @@ namespace IoTSharp.Data.Sqlite.Migrations
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_DataStorage_Produce_
Device
Id"
,
name
:
"FK_DataStorage_Produce_
Owner
Id"
,
table
:
"DataStorage"
);
migrationBuilder
.
DropForeignKey
(
...
...
@@ -96,12 +101,16 @@ namespace IoTSharp.Data.Sqlite.Migrations
table
:
"Device"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_DataStorage_
Device
Id"
,
name
:
"IX_DataStorage_
Owner
Id"
,
table
:
"DataStorage"
);
migrationBuilder
.
DropColumn
(
name
:
"ProduceId"
,
table
:
"Device"
);
migrationBuilder
.
DropColumn
(
name
:
"OwnerId"
,
table
:
"DataStorage"
);
}
}
}
IoTSharp.Data.Storage/IoTSharp.Data.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs
浏览文件 @
a23ad6b9
...
...
@@ -2191,7 +2191,10 @@ namespace IoTSharp.Data.Sqlite.Migrations
{
b
.
HasBaseType
(
"IoTSharp.Data.DataStorage"
);
b
.
HasIndex
(
"DeviceId"
);
b
.
Property
<
Guid
?>(
"OwnerId"
)
.
HasColumnType
(
"TEXT"
);
b
.
HasIndex
(
"OwnerId"
);
b
.
HasDiscriminator
().
HasValue
(
5
);
});
...
...
@@ -2676,9 +2679,7 @@ namespace IoTSharp.Data.Sqlite.Migrations
{
b
.
HasOne
(
"IoTSharp.Data.Produce"
,
"Owner"
)
.
WithMany
(
"DefaultAttributes"
)
.
HasForeignKey
(
"DeviceId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
.
HasForeignKey
(
"OwnerId"
);
b
.
Navigation
(
"Owner"
);
});
...
...
IoTSharp.Data/ApplicationDbContext.cs
浏览文件 @
a23ad6b9
...
...
@@ -36,8 +36,7 @@ namespace IoTSharp.Data
modelBuilder
.
Entity
<
Device
>().
HasOne
(
c
=>
c
.
DeviceIdentity
).
WithOne
(
c
=>
c
.
Device
).
HasForeignKey
<
DeviceIdentity
>(
c
=>
c
.
DeviceId
);
modelBuilder
.
Entity
<
Device
>().
HasDiscriminator
<
DeviceType
>(
nameof
(
Data
.
Device
.
DeviceType
)).
HasValue
<
Gateway
>(
DeviceType
.
Gateway
).
HasValue
<
Device
>(
DeviceType
.
Device
);
modelBuilder
.
Entity
<
Gateway
>().
HasDiscriminator
<
DeviceType
>(
nameof
(
Data
.
Device
.
DeviceType
));
modelBuilder
.
Entity
<
Produce
>().
HasMany
(
c
=>
c
.
DefaultAttributes
).
WithOne
(
c
=>
c
.
Owner
).
HasForeignKey
(
c
=>
c
.
DeviceId
);
;
var
builder_options
=
this
.
GetService
<
IDataBaseModelBuilderOptions
>();
builder_options
.
Infrastructure
=
this
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录