Rename WITS base table

This commit is contained in:
ngfrolov 2022-07-19 10:29:16 +05:00
parent 2b633c8425
commit 7b99e0fc88
3 changed files with 6269 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,185 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Rename_WITS_base_table : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_1_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_1");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_50_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_50");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_60_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_60");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_61_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_61");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_7_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_7");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_8_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_8");
migrationBuilder.DropPrimaryKey(
name: "PK_RecordBase",
table: "RecordBase");
migrationBuilder.RenameTable(
name: "RecordBase",
newName: "t_telemetry_wits_base");
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_wits_base",
table: "t_telemetry_wits_base",
columns: new[] { "id_telemetry", "date" });
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_1_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_1",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_50_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_50",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_60_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_60",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_61_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_61",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_7_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_7",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_8_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_8",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_1_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_1");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_50_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_50");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_60_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_60");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_61_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_61");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_7_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_7");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_8_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_8");
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_wits_base",
table: "t_telemetry_wits_base");
migrationBuilder.RenameTable(
name: "t_telemetry_wits_base",
newName: "RecordBase");
migrationBuilder.AddPrimaryKey(
name: "PK_RecordBase",
table: "RecordBase",
columns: new[] { "id_telemetry", "date" });
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_1_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_1",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_50_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_50",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_60_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_60",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_61_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_61",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_7_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_7",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_8_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_8",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -6,6 +6,7 @@ namespace AsbCloudDb.Model.WITS
/// <summary>
/// This is base class for all WITS-0 records
/// </summary>
[Table("t_telemetry_wits_base")]
public abstract class RecordBase : ITelemetryData
{
[Column("id_telemetry")]