DD.WellWorkover.Cloud/AsbCloudDb/Migrations/20220825062446_AddTable_t_well_final_documents.cs

80 lines
3.4 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class AddTable_t_well_final_documents : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_well_final_documents",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false),
id_user = table.Column<int>(type: "integer", nullable: false),
id_category = table.Column<int>(type: "integer", nullable: false),
id_file = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("t_well_final_documents_pk", x => x.id);
table.ForeignKey(
name: "FK_t_well_final_documents_t_file_category_id_category",
column: x => x.id_category,
principalTable: "t_file_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_well_final_documents_t_file_info_id_file",
column: x => x.id_file,
principalTable: "t_file_info",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_well_final_documents_t_user_id_user",
column: x => x.id_user,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_well_final_documents_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Дело скважины");
migrationBuilder.CreateIndex(
name: "IX_t_well_final_documents_id_category",
table: "t_well_final_documents",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_well_final_documents_id_file",
table: "t_well_final_documents",
column: "id_file");
migrationBuilder.CreateIndex(
name: "IX_t_well_final_documents_id_user",
table: "t_well_final_documents",
column: "id_user");
migrationBuilder.CreateIndex(
name: "IX_t_well_final_documents_id_well",
table: "t_well_final_documents",
column: "id_well");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_well_final_documents");
}
}
}