提交 10865b34 编写于 作者: 麦壳饼's avatar 麦壳饼

加入 数据库迁移信息

上级 e52eec64
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IoTSharp.Data.MySql.Migrations
{
public partial class remove_online_status : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device");
migrationBuilder.DropIndex(
name: "IX_Device_DeviceModelId",
table: "Device");
migrationBuilder.DropColumn(
name: "LastActive",
table: "Device");
migrationBuilder.DropColumn(
name: "Status",
table: "Device");
migrationBuilder.RenameColumn(
name: "Online",
table: "Device",
newName: "Deleted");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Deleted",
table: "Device",
newName: "Online");
migrationBuilder.AddColumn<DateTime>(
name: "LastActive",
table: "Device",
type: "timestamp",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "Status",
table: "Device",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_Device_DeviceModelId",
table: "Device",
column: "DeviceModelId");
migrationBuilder.AddForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device",
column: "DeviceModelId",
principalTable: "DeviceModels",
principalColumn: "DeviceModelId");
}
}
}
......@@ -579,30 +579,24 @@ namespace IoTSharp.Data.MySql.Migrations
b.Property<Guid?>("CustomerId")
.HasColumnType("char(36)");
b.Property<bool>("Deleted")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("DeviceModelId")
.HasColumnType("char(36)");
b.Property<int>("DeviceType")
.HasColumnType("int");
b.Property<DateTime>("LastActive")
.HasColumnType("timestamp");
b.Property<string>("Name")
.HasColumnType("longtext");
b.Property<bool>("Online")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("OwnerId")
.HasColumnType("char(36)");
b.Property<Guid?>("ProduceId")
.HasColumnType("char(36)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
......@@ -615,8 +609,6 @@ namespace IoTSharp.Data.MySql.Migrations
b.HasIndex("CustomerId");
b.HasIndex("DeviceModelId");
b.HasIndex("OwnerId");
b.HasIndex("ProduceId");
......@@ -2188,10 +2180,6 @@ namespace IoTSharp.Data.MySql.Migrations
.WithMany("Devices")
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.DeviceModel", "DeviceModel")
.WithMany()
.HasForeignKey("DeviceModelId");
b.HasOne("IoTSharp.Data.Gateway", "Owner")
.WithMany("Children")
.HasForeignKey("OwnerId");
......@@ -2206,8 +2194,6 @@ namespace IoTSharp.Data.MySql.Migrations
b.Navigation("Customer");
b.Navigation("DeviceModel");
b.Navigation("Owner");
b.Navigation("Tenant");
......
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=kissme -d mysql
\ No newline at end of file
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IoTSharp.Migrations
{
public partial class remove_online_status : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device");
migrationBuilder.DropIndex(
name: "IX_Device_DeviceModelId",
table: "Device");
migrationBuilder.DropColumn(
name: "LastActive",
table: "Device");
migrationBuilder.DropColumn(
name: "Status",
table: "Device");
migrationBuilder.RenameColumn(
name: "Online",
table: "Device",
newName: "Deleted");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Deleted",
table: "Device",
newName: "Online");
migrationBuilder.AddColumn<DateTime>(
name: "LastActive",
table: "Device",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "Status",
table: "Device",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_Device_DeviceModelId",
table: "Device",
column: "DeviceModelId");
migrationBuilder.AddForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device",
column: "DeviceModelId",
principalTable: "DeviceModels",
principalColumn: "DeviceModelId");
}
}
}
......@@ -588,30 +588,24 @@ namespace IoTSharp.Migrations
b.Property<Guid?>("CustomerId")
.HasColumnType("uuid");
b.Property<bool>("Deleted")
.HasColumnType("boolean");
b.Property<Guid?>("DeviceModelId")
.HasColumnType("uuid");
b.Property<int>("DeviceType")
.HasColumnType("integer");
b.Property<DateTime>("LastActive")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<bool>("Online")
.HasColumnType("boolean");
b.Property<Guid?>("OwnerId")
.HasColumnType("uuid");
b.Property<Guid?>("ProduceId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<Guid?>("TenantId")
.HasColumnType("uuid");
......@@ -624,8 +618,6 @@ namespace IoTSharp.Migrations
b.HasIndex("CustomerId");
b.HasIndex("DeviceModelId");
b.HasIndex("OwnerId");
b.HasIndex("ProduceId");
......@@ -2207,10 +2199,6 @@ namespace IoTSharp.Migrations
.WithMany("Devices")
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.DeviceModel", "DeviceModel")
.WithMany()
.HasForeignKey("DeviceModelId");
b.HasOne("IoTSharp.Data.Gateway", "Owner")
.WithMany("Children")
.HasForeignKey("OwnerId");
......@@ -2225,8 +2213,6 @@ namespace IoTSharp.Migrations
b.Navigation("Customer");
b.Navigation("DeviceModel");
b.Navigation("Owner");
b.Navigation("Tenant");
......
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IoTSharp.Data.SqlServer.Migrations
{
public partial class remove_online_status : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device");
migrationBuilder.DropIndex(
name: "IX_Device_DeviceModelId",
table: "Device");
migrationBuilder.DropColumn(
name: "LastActive",
table: "Device");
migrationBuilder.DropColumn(
name: "Status",
table: "Device");
migrationBuilder.RenameColumn(
name: "Online",
table: "Device",
newName: "Deleted");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Deleted",
table: "Device",
newName: "Online");
migrationBuilder.AddColumn<DateTime>(
name: "LastActive",
table: "Device",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "Status",
table: "Device",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_Device_DeviceModelId",
table: "Device",
column: "DeviceModelId");
migrationBuilder.AddForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device",
column: "DeviceModelId",
principalTable: "DeviceModels",
principalColumn: "DeviceModelId");
}
}
}
......@@ -588,30 +588,24 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("Deleted")
.HasColumnType("bit");
b.Property<Guid?>("DeviceModelId")
.HasColumnType("uniqueidentifier");
b.Property<int>("DeviceType")
.HasColumnType("int");
b.Property<DateTime>("LastActive")
.HasColumnType("datetime2");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Online")
.HasColumnType("bit");
b.Property<Guid?>("OwnerId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("ProduceId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
......@@ -624,8 +618,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.HasIndex("CustomerId");
b.HasIndex("DeviceModelId");
b.HasIndex("OwnerId");
b.HasIndex("ProduceId");
......@@ -2209,10 +2201,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
.WithMany("Devices")
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.DeviceModel", "DeviceModel")
.WithMany()
.HasForeignKey("DeviceModelId");
b.HasOne("IoTSharp.Data.Gateway", "Owner")
.WithMany("Children")
.HasForeignKey("OwnerId");
......@@ -2227,8 +2215,6 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Navigation("Customer");
b.Navigation("DeviceModel");
b.Navigation("Owner");
b.Navigation("Tenant");
......
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IoTSharp.Data.Sqlite.Migrations
{
public partial class remove_online_status : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device");
migrationBuilder.DropIndex(
name: "IX_Device_DeviceModelId",
table: "Device");
migrationBuilder.DropColumn(
name: "LastActive",
table: "Device");
migrationBuilder.DropColumn(
name: "Online",
table: "Device");
migrationBuilder.RenameColumn(
name: "Status",
table: "Device",
newName: "Deleted");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Deleted",
table: "Device",
newName: "Status");
migrationBuilder.AddColumn<DateTime>(
name: "LastActive",
table: "Device",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<bool>(
name: "Online",
table: "Device",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.CreateIndex(
name: "IX_Device_DeviceModelId",
table: "Device",
column: "DeviceModelId");
migrationBuilder.AddForeignKey(
name: "FK_Device_DeviceModels_DeviceModelId",
table: "Device",
column: "DeviceModelId",
principalTable: "DeviceModels",
principalColumn: "DeviceModelId");
}
}
}
......@@ -657,31 +657,25 @@ namespace IoTSharp.Data.Sqlite.Migrations
b.Property<Guid?>("CustomerId")
.HasColumnType("TEXT");
b.Property<bool>("Deleted")
.HasColumnType("INTEGER");
b.Property<Guid?>("DeviceModelId")
.HasColumnType("TEXT");
b.Property<int>("DeviceType")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastActive")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.Property<bool>("Online")
.HasColumnType("INTEGER");
b.Property<Guid?>("OwnerId")
.HasColumnType("TEXT");
b.Property<Guid?>("ProduceId")
.HasColumnType("TEXT");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<Guid?>("TenantId")
.HasColumnType("TEXT");
......@@ -694,8 +688,6 @@ namespace IoTSharp.Data.Sqlite.Migrations
b.HasIndex("CustomerId");
b.HasIndex("DeviceModelId");
b.HasIndex("OwnerId");
b.HasIndex("ProduceId");
......@@ -2431,10 +2423,6 @@ namespace IoTSharp.Data.Sqlite.Migrations
.WithMany("Devices")
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.DeviceModel", "DeviceModel")
.WithMany()
.HasForeignKey("DeviceModelId");
b.HasOne("IoTSharp.Data.Gateway", "Owner")
.WithMany("Children")
.HasForeignKey("OwnerId");
......@@ -2449,8 +2437,6 @@ namespace IoTSharp.Data.Sqlite.Migrations
b.Navigation("Customer");
b.Navigation("DeviceModel");
b.Navigation("Owner");
b.Navigation("Tenant");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册