diff options
| author | Jake Mannens <jake@asger.xyz> | 2024-09-20 16:13:30 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2024-10-28 14:53:04 +1100 |
| commit | 7c6009abd22d8461039be15d0fd069a460340585 (patch) | |
| tree | 580890eacc1ae2d86ee3f95927e3aed47bb12c96 /Migrations/20230705160931_Initial.cs | |
v0.1v0.1
Diffstat (limited to 'Migrations/20230705160931_Initial.cs')
| -rw-r--r-- | Migrations/20230705160931_Initial.cs | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/Migrations/20230705160931_Initial.cs b/Migrations/20230705160931_Initial.cs new file mode 100644 index 0000000..9f3068f --- /dev/null +++ b/Migrations/20230705160931_Initial.cs @@ -0,0 +1,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"); + } + } +} |
