Files
sanctions-search/src/SanctionsSearch.Worker/Migrations/20240819001854_initial_migration.cs
T

134 lines
5.5 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SanctionsSearch.Worker.Migrations
{
/// <inheritdoc />
public partial class initial_migration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Sdns",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<string>(type: "TEXT", nullable: false),
Program = table.Column<string>(type: "TEXT", nullable: false),
Title = table.Column<string>(type: "TEXT", nullable: false),
CallSign = table.Column<string>(type: "TEXT", nullable: false),
VesselType = table.Column<string>(type: "TEXT", nullable: false),
Tonnage = table.Column<string>(type: "TEXT", nullable: false),
GrossRegisteredTonnage = table.Column<string>(type: "TEXT", nullable: false),
VesselFlag = table.Column<string>(type: "TEXT", nullable: false),
VesselOwner = table.Column<string>(type: "TEXT", nullable: false),
Remarks = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Sdns", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Addresses",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SdnId = table.Column<int>(type: "INTEGER", nullable: false),
StreetAddress = table.Column<string>(type: "TEXT", nullable: false),
CityProvincePostal = table.Column<string>(type: "TEXT", nullable: false),
Country = table.Column<string>(type: "TEXT", nullable: false),
Remarks = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Addresses", x => x.Id);
table.ForeignKey(
name: "FK_Addresses_Sdns_SdnId",
column: x => x.SdnId,
principalTable: "Sdns",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Aliases",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SdnId = table.Column<int>(type: "INTEGER", nullable: false),
Type = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Remarks = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Aliases", x => x.Id);
table.ForeignKey(
name: "FK_Aliases_Sdns_SdnId",
column: x => x.SdnId,
principalTable: "Sdns",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Comments",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SdnId = table.Column<int>(type: "INTEGER", nullable: false),
Remarks = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Comments", x => x.Id);
table.ForeignKey(
name: "FK_Comments_Sdns_SdnId",
column: x => x.SdnId,
principalTable: "Sdns",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Addresses_SdnId",
table: "Addresses",
column: "SdnId");
migrationBuilder.CreateIndex(
name: "IX_Aliases_SdnId",
table: "Aliases",
column: "SdnId");
migrationBuilder.CreateIndex(
name: "IX_Comments_SdnId",
table: "Comments",
column: "SdnId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Addresses");
migrationBuilder.DropTable(
name: "Aliases");
migrationBuilder.DropTable(
name: "Comments");
migrationBuilder.DropTable(
name: "Sdns");
}
}
}