forked from ddrilling/AsbCloudServer
385 lines
16 KiB
C#
385 lines
16 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace AsbCloudDb.Migrations
|
|||
|
{
|
|||
|
public partial class Update_ProcessMaps : Migration
|
|||
|
{
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_process_map_t_well_section_type_id_wellsection_type",
|
|||
|
table: "t_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_process_map_t_well_well_id",
|
|||
|
table: "t_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_process_map_wellbore_development_t_user_id_user",
|
|||
|
table: "t_process_map_wellbore_development");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_process_map_wellbore_development_t_well_id_well",
|
|||
|
table: "t_process_map_wellbore_development");
|
|||
|
|
|||
|
migrationBuilder.DropPrimaryKey(
|
|||
|
name: "PK_t_process_map_wellbore_development",
|
|||
|
table: "t_process_map_wellbore_development");
|
|||
|
|
|||
|
migrationBuilder.DropPrimaryKey(
|
|||
|
name: "PK_t_process_map",
|
|||
|
table: "t_process_map");
|
|||
|
|
|||
|
migrationBuilder.DeleteData(
|
|||
|
table: "t_relation_user_role_permission",
|
|||
|
keyColumns: new[] { "id_permission", "id_user_role" },
|
|||
|
keyValues: new object[] { 513, 1 });
|
|||
|
|
|||
|
migrationBuilder.DeleteData(
|
|||
|
table: "t_relation_user_role_permission",
|
|||
|
keyColumns: new[] { "id_permission", "id_user_role" },
|
|||
|
keyValues: new object[] { 514, 1 });
|
|||
|
|
|||
|
migrationBuilder.DeleteData(
|
|||
|
table: "t_relation_user_role_permission",
|
|||
|
keyColumns: new[] { "id_permission", "id_user_role" },
|
|||
|
keyValues: new object[] { 515, 1 });
|
|||
|
|
|||
|
migrationBuilder.DeleteData(
|
|||
|
table: "t_permission",
|
|||
|
keyColumn: "id",
|
|||
|
keyValue: 513);
|
|||
|
|
|||
|
migrationBuilder.DeleteData(
|
|||
|
table: "t_permission",
|
|||
|
keyColumn: "id",
|
|||
|
keyValue: 514);
|
|||
|
|
|||
|
migrationBuilder.DeleteData(
|
|||
|
table: "t_permission",
|
|||
|
keyColumn: "id",
|
|||
|
keyValue: 515);
|
|||
|
|
|||
|
migrationBuilder.RenameTable(
|
|||
|
name: "t_process_map_wellbore_development",
|
|||
|
newName: "t_well_ream_process_map");
|
|||
|
|
|||
|
migrationBuilder.RenameTable(
|
|||
|
name: "t_process_map",
|
|||
|
newName: "t_well_drilling_process_map");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_process_map_wellbore_development_id_well",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
newName: "IX_t_well_ream_process_map_id_well");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_process_map_wellbore_development_id_user",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
newName: "IX_t_well_ream_process_map_id_user");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "well_id",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
newName: "id_well");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_process_map_well_id",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
newName: "IX_t_well_drilling_process_map_id_well");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_process_map_id_wellsection_type",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
newName: "IX_t_well_drilling_process_map_id_wellsection_type");
|
|||
|
|
|||
|
migrationBuilder.AlterTable(
|
|||
|
name: "t_well_ream_process_map",
|
|||
|
comment: "РТК проработка скважины",
|
|||
|
oldComment: "РТК план проработка скважины");
|
|||
|
|
|||
|
migrationBuilder.AlterTable(
|
|||
|
name: "t_well_drilling_process_map",
|
|||
|
comment: "РТК бурение скважины",
|
|||
|
oldComment: "Операции по скважине – РТК");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_start",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Глубина по стволу от, м",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Стартовая глубина, м");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_end",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Глубина по стволу до, м",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Окончательная глубина, м");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_start",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Глубина по стволу от, м",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Стартовая глубина");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_end",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Глубина по стволу до, м",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Глубина окончания интервала");
|
|||
|
|
|||
|
migrationBuilder.AddPrimaryKey(
|
|||
|
name: "PK_t_well_ream_process_map",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
column: "id");
|
|||
|
|
|||
|
migrationBuilder.AddPrimaryKey(
|
|||
|
name: "PK_t_well_drilling_process_map",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
column: "id");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_well_drilling_process_map_id_user",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
column: "id_user");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_well_drilling_process_map_t_user_id_user",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
column: "id_user",
|
|||
|
principalTable: "t_user",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_well_drilling_process_map_t_well_id_well",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
column: "id_well",
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_well_drilling_process_map_t_well_section_type_id_wellsect~",
|
|||
|
table: "t_well_drilling_process_map",
|
|||
|
column: "id_wellsection_type",
|
|||
|
principalTable: "t_well_section_type",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_well_ream_process_map_t_user_id_user",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
column: "id_user",
|
|||
|
principalTable: "t_user",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_well_ream_process_map_t_well_id_well",
|
|||
|
table: "t_well_ream_process_map",
|
|||
|
column: "id_well",
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_well_drilling_process_map_t_user_id_user",
|
|||
|
table: "t_well_drilling_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_well_drilling_process_map_t_well_id_well",
|
|||
|
table: "t_well_drilling_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_well_drilling_process_map_t_well_section_type_id_wellsect~",
|
|||
|
table: "t_well_drilling_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_well_ream_process_map_t_user_id_user",
|
|||
|
table: "t_well_ream_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_t_well_ream_process_map_t_well_id_well",
|
|||
|
table: "t_well_ream_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropPrimaryKey(
|
|||
|
name: "PK_t_well_ream_process_map",
|
|||
|
table: "t_well_ream_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropPrimaryKey(
|
|||
|
name: "PK_t_well_drilling_process_map",
|
|||
|
table: "t_well_drilling_process_map");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_t_well_drilling_process_map_id_user",
|
|||
|
table: "t_well_drilling_process_map");
|
|||
|
|
|||
|
migrationBuilder.RenameTable(
|
|||
|
name: "t_well_ream_process_map",
|
|||
|
newName: "t_process_map_wellbore_development");
|
|||
|
|
|||
|
migrationBuilder.RenameTable(
|
|||
|
name: "t_well_drilling_process_map",
|
|||
|
newName: "t_process_map");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_well_ream_process_map_id_well",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
newName: "IX_t_process_map_wellbore_development_id_well");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_well_ream_process_map_id_user",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
newName: "IX_t_process_map_wellbore_development_id_user");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "id_well",
|
|||
|
table: "t_process_map",
|
|||
|
newName: "well_id");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_well_drilling_process_map_id_wellsection_type",
|
|||
|
table: "t_process_map",
|
|||
|
newName: "IX_t_process_map_id_wellsection_type");
|
|||
|
|
|||
|
migrationBuilder.RenameIndex(
|
|||
|
name: "IX_t_well_drilling_process_map_id_well",
|
|||
|
table: "t_process_map",
|
|||
|
newName: "IX_t_process_map_well_id");
|
|||
|
|
|||
|
migrationBuilder.AlterTable(
|
|||
|
name: "t_process_map_wellbore_development",
|
|||
|
comment: "РТК план проработка скважины",
|
|||
|
oldComment: "РТК проработка скважины");
|
|||
|
|
|||
|
migrationBuilder.AlterTable(
|
|||
|
name: "t_process_map",
|
|||
|
comment: "Операции по скважине – РТК",
|
|||
|
oldComment: "РТК бурение скважины");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_start",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Стартовая глубина, м",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Глубина по стволу от, м");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_end",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Окончательная глубина, м",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Глубина по стволу до, м");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_start",
|
|||
|
table: "t_process_map",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Стартовая глубина",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Глубина по стволу от, м");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<double>(
|
|||
|
name: "depth_end",
|
|||
|
table: "t_process_map",
|
|||
|
type: "double precision",
|
|||
|
nullable: false,
|
|||
|
comment: "Глубина окончания интервала",
|
|||
|
oldClrType: typeof(double),
|
|||
|
oldType: "double precision",
|
|||
|
oldComment: "Глубина по стволу до, м");
|
|||
|
|
|||
|
migrationBuilder.AddPrimaryKey(
|
|||
|
name: "PK_t_process_map_wellbore_development",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
column: "id");
|
|||
|
|
|||
|
migrationBuilder.AddPrimaryKey(
|
|||
|
name: "PK_t_process_map",
|
|||
|
table: "t_process_map",
|
|||
|
column: "id");
|
|||
|
|
|||
|
migrationBuilder.InsertData(
|
|||
|
table: "t_permission",
|
|||
|
columns: new[] { "id", "description", "name" },
|
|||
|
values: new object[,]
|
|||
|
{
|
|||
|
{ 513, "Разрешение просматривать РТК", "ProcessMap.get" },
|
|||
|
{ 514, "Разрешение редактировать РТК", "ProcessMap.edit" },
|
|||
|
{ 515, "Разрешение удалять РТК", "ProcessMap.delete" }
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.InsertData(
|
|||
|
table: "t_relation_user_role_permission",
|
|||
|
columns: new[] { "id_permission", "id_user_role" },
|
|||
|
values: new object[,]
|
|||
|
{
|
|||
|
{ 513, 1 },
|
|||
|
{ 514, 1 },
|
|||
|
{ 515, 1 }
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_process_map_t_well_section_type_id_wellsection_type",
|
|||
|
table: "t_process_map",
|
|||
|
column: "id_wellsection_type",
|
|||
|
principalTable: "t_well_section_type",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_process_map_t_well_well_id",
|
|||
|
table: "t_process_map",
|
|||
|
column: "well_id",
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_process_map_wellbore_development_t_user_id_user",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
column: "id_user",
|
|||
|
principalTable: "t_user",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_t_process_map_wellbore_development_t_well_id_well",
|
|||
|
table: "t_process_map_wellbore_development",
|
|||
|
column: "id_well",
|
|||
|
principalTable: "t_well",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|