2024-07-04 11:02:45 +05:00
|
|
|
using System;
|
2023-11-03 17:56:26 +05:00
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
namespace AsbCloudDb.Migrations
|
|
|
|
{
|
|
|
|
public partial class Update_DailyReport : Migration
|
|
|
|
{
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
{
|
2023-11-16 12:05:52 +05:00
|
|
|
migrationBuilder.Sql("Truncate table t_daily_report");
|
|
|
|
|
2023-11-03 17:56:26 +05:00
|
|
|
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>(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "date",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report",
|
|
|
|
type: "timestamp with time zone",
|
|
|
|
nullable: false,
|
|
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
2023-11-14 10:44:06 +05:00
|
|
|
comment: "Дата формирования отчёта");
|
2023-11-03 17:56:26 +05:00
|
|
|
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
|
|
name: "date_last_update",
|
|
|
|
table: "t_daily_report",
|
|
|
|
type: "timestamp with time zone",
|
|
|
|
nullable: true,
|
|
|
|
comment: "Дата последнего обновления");
|
|
|
|
|
2023-11-14 10:44:06 +05:00
|
|
|
migrationBuilder.AddColumn<string>(
|
|
|
|
name: "sign_block",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report",
|
2023-11-14 10:44:06 +05:00
|
|
|
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: "Баланс времени");
|
2023-11-03 17:56:26 +05:00
|
|
|
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
|
|
name: "PK_t_daily_report",
|
|
|
|
table: "t_daily_report",
|
|
|
|
column: "Id");
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "IX_t_daily_report_id_well_date",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report",
|
2023-11-14 10:44:06 +05:00
|
|
|
columns: new[] { "id_well", "date" },
|
2023-11-03 17:56:26 +05:00
|
|
|
unique: true);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
{
|
2023-11-16 12:05:52 +05:00
|
|
|
migrationBuilder.Sql("Truncate table t_daily_report");
|
|
|
|
|
2023-11-03 17:56:26 +05:00
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
|
|
name: "PK_t_daily_report",
|
|
|
|
table: "t_daily_report");
|
|
|
|
|
|
|
|
migrationBuilder.DropIndex(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "IX_t_daily_report_id_well_date",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report");
|
2023-11-14 10:44:06 +05:00
|
|
|
|
2023-11-03 17:56:26 +05:00
|
|
|
migrationBuilder.DropColumn(
|
|
|
|
name: "Id",
|
|
|
|
table: "t_daily_report");
|
|
|
|
|
|
|
|
migrationBuilder.DropColumn(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "date",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report");
|
|
|
|
|
|
|
|
migrationBuilder.DropColumn(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "date_last_update",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report");
|
|
|
|
|
|
|
|
migrationBuilder.DropColumn(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "sign_block",
|
|
|
|
table: "t_daily_report");
|
|
|
|
|
|
|
|
migrationBuilder.DropColumn(
|
|
|
|
name: "subsystem_block",
|
2023-11-03 17:56:26 +05:00
|
|
|
table: "t_daily_report");
|
|
|
|
|
|
|
|
migrationBuilder.DropColumn(
|
2023-11-14 10:44:06 +05:00
|
|
|
name: "time_balance_block",
|
2023-11-03 17:56:26 +05:00
|
|
|
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",
|
2023-11-16 12:05:52 +05:00
|
|
|
nullable: true,
|
2023-11-03 17:56:26 +05:00
|
|
|
comment: "Список параметров для отчёта");
|
|
|
|
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
|
|
name: "t_id_well_date_start_pk",
|
|
|
|
table: "t_daily_report",
|
|
|
|
columns: new[] { "id_well", "start_date" });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|