forked from ddrilling/AsbCloudServer
94 lines
4.4 KiB
C#
94 lines
4.4 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
namespace AsbCloudDb.Migrations
|
|||
|
{
|
|||
|
public partial class Rename_CompositeWell_to_WellComposite : Migration
|
|||
|
{
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "t_сomposite_well");
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "t_well_сomposite",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
|
|||
|
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
|
|||
|
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_t_well_сomposite", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_well_сomposite_src_t_well_id_fk",
|
|||
|
column: x => x.id_well_src,
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_well_сomposite_t_well_id_fk",
|
|||
|
column: x => x.id_well,
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_well_сomposite_t_well_section_type_id_fk",
|
|||
|
column: x => x.id_well_src,
|
|||
|
principalTable: "t_well_section_type",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
},
|
|||
|
comment: "Композитная скважина");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_well_сomposite_id_well_src",
|
|||
|
table: "t_well_сomposite",
|
|||
|
column: "id_well_src");
|
|||
|
}
|
|||
|
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "t_well_сomposite");
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "t_сomposite_well",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
|
|||
|
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
|
|||
|
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_сomposite_well_src_t_well_id_fk",
|
|||
|
column: x => x.id_well_src,
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_сomposite_well_t_well_id_fk",
|
|||
|
column: x => x.id_well,
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_сomposite_well_t_well_section_type_id_fk",
|
|||
|
column: x => x.id_well_src,
|
|||
|
principalTable: "t_well_section_type",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
},
|
|||
|
comment: "Композитная скважина");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_сomposite_well_id_well_src",
|
|||
|
table: "t_сomposite_well",
|
|||
|
column: "id_well_src");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|