using Microsoft.EntityFrameworkCore.Migrations; namespace AsbCloudDb.Migrations { public partial class Set_Telemetry_FKs_OnDelete_Cascade : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub"); migrationBuilder.DropForeignKey( name: "t_telemetry_data_spin_t_telemetry_id_fk", table: "t_telemetry_data_spin"); migrationBuilder.DropForeignKey( name: "t_telemetry_user_t_telemetry_id_fk", table: "t_telemetry_user"); migrationBuilder.DropForeignKey( name: "t_user_t_company_id_fk", table: "t_user"); migrationBuilder.DropForeignKey( name: "t_well_t_telemetry_id_fk", table: "t_well"); migrationBuilder.AddForeignKey( name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "t_telemetry_data_spin_t_telemetry_id_fk", table: "t_telemetry_data_spin", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "t_telemetry_user_t_telemetry_id_fk", table: "t_telemetry_user", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "t_user_t_company_id_fk", table: "t_user", column: "id_company", principalTable: "t_company", principalColumn: "id", onDelete: ReferentialAction.SetNull); migrationBuilder.AddForeignKey( name: "t_well_t_telemetry_id_fk", table: "t_well", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.SetNull); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub"); migrationBuilder.DropForeignKey( name: "t_telemetry_data_spin_t_telemetry_id_fk", table: "t_telemetry_data_spin"); migrationBuilder.DropForeignKey( name: "t_telemetry_user_t_telemetry_id_fk", table: "t_telemetry_user"); migrationBuilder.DropForeignKey( name: "t_user_t_company_id_fk", table: "t_user"); migrationBuilder.DropForeignKey( name: "t_well_t_telemetry_id_fk", table: "t_well"); migrationBuilder.AddForeignKey( name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "t_telemetry_data_spin_t_telemetry_id_fk", table: "t_telemetry_data_spin", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "t_telemetry_user_t_telemetry_id_fk", table: "t_telemetry_user", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "t_user_t_company_id_fk", table: "t_user", column: "id_company", principalTable: "t_company", principalColumn: "id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "t_well_t_telemetry_id_fk", table: "t_well", column: "id_telemetry", principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Restrict); } } }