using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
using System;

#nullable disable

namespace AsbCloudDb.Migrations
{
    public partial class Add_DailyReport_Table : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "t_daily_report",
                columns: table => new
                {
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "ID скважины"),
                    start_date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата отчёта"),
                    info = table.Column<DailyReportInfo>(type: "jsonb", nullable: true, comment: "Список параметров для отчёта")
                },
                constraints: table =>
                {
                    table.PrimaryKey("t_id_well_date_start_pk", x => new { x.id_well, x.start_date });
                    table.ForeignKey(
                        name: "FK_t_daily_report_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Ежедневные отчёты");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "t_daily_report");
        }
    }
}