add Voltage and Power fields
This commit is contained in:
1224
src/GreenHome.Infrastructure/Migrations/20260106150615_POWER_VOLTAGE_FIELDS.Designer.cs
generated
Normal file
1224
src/GreenHome.Infrastructure/Migrations/20260106150615_POWER_VOLTAGE_FIELDS.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreenHome.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class POWER_VOLTAGE_FIELDS : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<byte>(
|
||||
name: "Power",
|
||||
table: "Telemetry",
|
||||
type: "tinyint",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Voltage",
|
||||
table: "Telemetry",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Power",
|
||||
table: "Telemetry");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Voltage",
|
||||
table: "Telemetry");
|
||||
}
|
||||
}
|
||||
}
|
||||
1224
src/GreenHome.Infrastructure/Migrations/20260106151206_FIX_VOLTAGE_TYPE.Designer.cs
generated
Normal file
1224
src/GreenHome.Infrastructure/Migrations/20260106151206_FIX_VOLTAGE_TYPE.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreenHome.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FIX_VOLTAGE_TYPE : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "Voltage",
|
||||
table: "Telemetry",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Voltage",
|
||||
table: "Telemetry",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "decimal(18,2)",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -740,6 +740,9 @@ namespace GreenHome.Infrastructure.Migrations
|
||||
b.Property<int>("PersianYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte?>("Power")
|
||||
.HasColumnType("tinyint");
|
||||
|
||||
b.Property<DateTime>("ServerTimestampUtc")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -752,6 +755,9 @@ namespace GreenHome.Infrastructure.Migrations
|
||||
b.Property<DateTime>("TimestampUtc")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<decimal?>("Voltage")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DeviceId", "ServerTimestampUtc");
|
||||
|
||||
@@ -40,7 +40,7 @@ public sealed class TelemetryService : ITelemetryService
|
||||
// ذخیره زمان سرور در لحظه ثبت
|
||||
entity.ServerTimestampUtc = DateTime.Now;
|
||||
|
||||
var dt = dto.TimestampUtc.ToLocalTime();
|
||||
var dt = dto.TimestampUtc!.Value.ToLocalTime();
|
||||
var py = PersianCalendar.GetYear(dt);
|
||||
var pm = PersianCalendar.GetMonth(dt);
|
||||
var pd = PersianCalendar.GetDayOfMonth(dt);
|
||||
|
||||
Reference in New Issue
Block a user