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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace PagerParser.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GpsPositions",
columns: table => new
{
GpsPositionId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Latitude = table.Column<double>(type: "double precision", nullable: false),
Longitude = table.Column<double>(type: "double precision", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GpsPositions", x => x.GpsPositionId);
});
migrationBuilder.CreateTable(
name: "PagerMessages",
columns: table => new
{
PagerMessageId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Timestamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Message = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PagerMessages", x => x.PagerMessageId);
});
migrationBuilder.CreateTable(
name: "ParsedPagerMessages",
columns: table => new
{
ParsedPagerMessageId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FirecomJobNo = table.Column<int>(type: "integer", nullable: false),
AssignmentArea = table.Column<string>(type: "text", nullable: false),
JobType = table.Column<string>(type: "text", nullable: false),
AlertLevel = table.Column<int>(type: "integer", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
MelwaysMapNo = table.Column<int>(type: "integer", nullable: true),
MelwaysGrid = table.Column<string>(type: "text", nullable: true),
GridReference = table.Column<int>(type: "integer", nullable: true),
AttendingServices = table.Column<int>(type: "integer", nullable: false),
Note = table.Column<string>(type: "text", nullable: true),
FireGroundChannel = table.Column<int>(type: "integer", nullable: true),
PageDestination = table.Column<string>(type: "text", nullable: false),
GpsPositionId = table.Column<int>(type: "integer", nullable: true),
PagerMessage = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ParsedPagerMessages", x => x.ParsedPagerMessageId);
table.ForeignKey(
name: "FK_ParsedPagerMessages_GpsPositions_GpsPositionId",
column: x => x.GpsPositionId,
principalTable: "GpsPositions",
principalColumn: "GpsPositionId");
table.ForeignKey(
name: "FK_ParsedPagerMessages_PagerMessages_PagerMessage",
column: x => x.PagerMessage,
principalTable: "PagerMessages",
principalColumn: "PagerMessageId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PagerMessages_Message",
table: "PagerMessages",
column: "Message");
migrationBuilder.CreateIndex(
name: "IX_ParsedPagerMessages_FirecomJobNo",
table: "ParsedPagerMessages",
column: "FirecomJobNo");
migrationBuilder.CreateIndex(
name: "IX_ParsedPagerMessages_GpsPositionId",
table: "ParsedPagerMessages",
column: "GpsPositionId");
migrationBuilder.CreateIndex(
name: "IX_ParsedPagerMessages_PagerMessage",
table: "ParsedPagerMessages",
column: "PagerMessage",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ParsedPagerMessages");
migrationBuilder.DropTable(
name: "GpsPositions");
migrationBuilder.DropTable(
name: "PagerMessages");
}
}
}
|