20260521093000_AddAlarmLogs.cs
3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Rcs.Infrastructure.DB.MsSql;
#nullable disable
namespace Rcs.Infrastructure.Migrations
{
/// <inheritdoc />
[DbContext(typeof(AppDbContext))]
[Migration("20260521093000_AddAlarmLogs")]
public partial class AddAlarmLogs : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "alarm_logs",
columns: table => new
{
alarm_log_id = table.Column<Guid>(type: "uuid", nullable: false),
alarm_code = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
alarm_type = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
level = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
source_type = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
source_code = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
source_name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
title = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
message = table.Column<string>(type: "text", nullable: false),
details = table.Column<string>(type: "text", nullable: true),
extra_data = table.Column<string>(type: "text", nullable: true),
is_acknowledged = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
acknowledged_by = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
acknowledge_remark = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
acknowledged_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
occurred_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
resolved_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
created_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
updated_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_alarm_logs", x => x.alarm_log_id);
});
migrationBuilder.CreateIndex(
name: "idx_alarm_logs_alarm_code",
table: "alarm_logs",
column: "alarm_code");
migrationBuilder.CreateIndex(
name: "idx_alarm_logs_is_acknowledged",
table: "alarm_logs",
column: "is_acknowledged");
migrationBuilder.CreateIndex(
name: "idx_alarm_logs_level",
table: "alarm_logs",
column: "level");
migrationBuilder.CreateIndex(
name: "idx_alarm_logs_occurred_at",
table: "alarm_logs",
column: "occurred_at");
migrationBuilder.CreateIndex(
name: "idx_alarm_logs_source_code",
table: "alarm_logs",
column: "source_code");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "alarm_logs");
}
}
}