forked from ddrilling/AsbCloudServer
Add dailyReport LOST migration
This commit is contained in:
parent
e8bbff2d3c
commit
6b1352e022
9083
AsbCloudDb/Migrations/20231205060749_Daily_report_lost_migration.Designer.cs
generated
Normal file
9083
AsbCloudDb/Migrations/20231205060749_Daily_report_lost_migration.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,248 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Daily_report_lost_migration : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "DailyReport");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "t_id_well_date_start_pk",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "start_date",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "info",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Id",
|
||||
table: "t_daily_report",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "date",
|
||||
table: "t_daily_report",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
comment: "Дата формирования отчёта");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "date_last_update",
|
||||
table: "t_daily_report",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
comment: "Дата последнего обновления");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "sign_block",
|
||||
table: "t_daily_report",
|
||||
type: "jsonb",
|
||||
nullable: true,
|
||||
comment: "Подпись");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "subsystem_block",
|
||||
table: "t_daily_report",
|
||||
type: "jsonb",
|
||||
nullable: true,
|
||||
comment: "Наработкой подсистем");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "time_balance_block",
|
||||
table: "t_daily_report",
|
||||
type: "jsonb",
|
||||
nullable: true,
|
||||
comment: "Баланс времени");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_t_daily_report",
|
||||
table: "t_daily_report",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 1,
|
||||
column: "is_contact",
|
||||
value: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 2,
|
||||
column: "is_contact",
|
||||
value: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 3,
|
||||
column: "is_contact",
|
||||
value: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 7,
|
||||
column: "is_contact",
|
||||
value: false);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 12,
|
||||
column: "order",
|
||||
value: 8);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "t_company_type",
|
||||
columns: new[] { "id", "caption", "is_contact", "order" },
|
||||
values: new object[] { 11, "Дизельный сервис", false, 9 });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_daily_report_id_well_date",
|
||||
table: "t_daily_report",
|
||||
columns: new[] { "id_well", "date" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_daily_report_t_well_id_well",
|
||||
table: "t_daily_report",
|
||||
column: "id_well",
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_daily_report_t_well_id_well",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_t_daily_report",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_t_daily_report_id_well_date",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 11);
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Id",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "date",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "date_last_update",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "sign_block",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "subsystem_block",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "time_balance_block",
|
||||
table: "t_daily_report");
|
||||
|
||||
migrationBuilder.AddColumn<DateOnly>(
|
||||
name: "start_date",
|
||||
table: "t_daily_report",
|
||||
type: "date",
|
||||
nullable: false,
|
||||
defaultValue: new DateOnly(1, 1, 1),
|
||||
comment: "Дата отчёта");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "info",
|
||||
table: "t_daily_report",
|
||||
type: "jsonb",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
comment: "Список параметров для отчёта");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "t_id_well_date_start_pk",
|
||||
table: "t_daily_report",
|
||||
columns: new[] { "id_well", "start_date" });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DailyReport",
|
||||
columns: table => new
|
||||
{
|
||||
IdWell = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.ForeignKey(
|
||||
name: "FK_DailyReport_t_well_IdWell",
|
||||
column: x => x.IdWell,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 1,
|
||||
column: "is_contact",
|
||||
value: false);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 2,
|
||||
column: "is_contact",
|
||||
value: false);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 3,
|
||||
column: "is_contact",
|
||||
value: false);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 7,
|
||||
column: "is_contact",
|
||||
value: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "t_company_type",
|
||||
keyColumn: "id",
|
||||
keyValue: 12,
|
||||
column: "order",
|
||||
value: 7);
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ namespace AsbCloudDb.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.UseCollation("Russian_Russia.1251")
|
||||
.HasAnnotation("ProductVersion", "6.0.22")
|
||||
.HasAnnotation("ProductVersion", "6.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
|
||||
@ -136,21 +136,21 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
Caption = "Недропользователь",
|
||||
IsContact = false,
|
||||
IsContact = true,
|
||||
Order = 3
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Caption = "Буровой подрядчик",
|
||||
IsContact = false,
|
||||
IsContact = true,
|
||||
Order = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Caption = "Сервис автоматизации бурения",
|
||||
IsContact = false,
|
||||
IsContact = true,
|
||||
Order = 0
|
||||
},
|
||||
new
|
||||
@ -178,7 +178,7 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
Id = 7,
|
||||
Caption = "Служба супервайзинга",
|
||||
IsContact = true,
|
||||
IsContact = false,
|
||||
Order = 1
|
||||
},
|
||||
new
|
||||
@ -189,11 +189,18 @@ namespace AsbCloudDb.Migrations
|
||||
Order = 7
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
Caption = "Дизельный сервис",
|
||||
IsContact = false,
|
||||
Order = 9
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
Caption = "Сервис по обслуживанию верхних силовых приводов",
|
||||
IsContact = true,
|
||||
Order = 7
|
||||
Order = 8
|
||||
});
|
||||
});
|
||||
|
||||
@ -264,24 +271,46 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date")
|
||||
.HasComment("Дата формирования отчёта");
|
||||
|
||||
b.Property<DateTime?>("DateLastUpdate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_last_update")
|
||||
.HasComment("Дата последнего обновления");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date")
|
||||
.HasComment("Дата отчёта");
|
||||
|
||||
b.Property<string>("Info")
|
||||
.IsRequired()
|
||||
b.Property<string>("SignBlock")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("info")
|
||||
.HasComment("Список параметров для отчёта");
|
||||
.HasColumnName("sign_block")
|
||||
.HasComment("Подпись");
|
||||
|
||||
b.HasKey("IdWell", "StartDate")
|
||||
.HasName("t_id_well_date_start_pk");
|
||||
b.Property<string>("SubsystemBlock")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("subsystem_block")
|
||||
.HasComment("Наработкой подсистем");
|
||||
|
||||
b.Property<string>("TimeBalanceBlock")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("time_balance_block")
|
||||
.HasComment("Баланс времени");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdWell", "Date")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("t_daily_report");
|
||||
|
||||
@ -8066,7 +8095,7 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
|
||||
modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
|
Loading…
Reference in New Issue
Block a user