using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Persistence.Database.Postgres.Migrations
{
    /// <inheritdoc />
    public partial class TechMessageMigration : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "Created",
                table: "Setpoint",
                type: "timestamp with time zone",
                nullable: false,
                comment: "Дата создания уставки",
                oldClrType: typeof(DateTimeOffset),
                oldType: "timestamp with time zone",
                oldComment: "Дата изменения уставки");

            migrationBuilder.CreateTable(
                name: "TechMessage",
                columns: table => new
                {
                    EventId = table.Column<Guid>(type: "uuid", nullable: false, comment: "Id события"),
                    ImportantId = table.Column<int>(type: "integer", nullable: false, comment: "Id Категории важности"),
                    OccurrenceDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата возникновения"),
                    Depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина забоя"),
                    MessageText = table.Column<string>(type: "varchar(512)", nullable: true, comment: "Текст сообщения"),
                    AutoDrillingSystem = table.Column<string>(type: "varchar(256)", nullable: true, comment: "Система автобурения, к которой относится сообщение"),
                    UserId = table.Column<Guid>(type: "uuid", nullable: false, comment: "Id пользователя за пультом бурильщика")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TechMessage", x => x.EventId);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "TechMessage");

            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "Created",
                table: "Setpoint",
                type: "timestamp with time zone",
                nullable: false,
                comment: "Дата изменения уставки",
                oldClrType: typeof(DateTimeOffset),
                oldType: "timestamp with time zone",
                oldComment: "Дата создания уставки");
        }
    }
}