using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Monitoring.Infrastructure.Data.Migrations
{
    /// <inheritdoc />
    public partial class AddAlarmResetComments : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AlarmResetComments",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    OrganizationId = table.Column<Guid>(type: "uuid", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AlarmResetComments", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AlarmResetComments_Organizations_OrganizationId",
                        column: x => x.OrganizationId,
                        principalTable: "Organizations",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AlarmResetCommentTranslates",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    Value = table.Column<string>(type: "text", nullable: false),
                    Language = table.Column<string>(type: "text", nullable: false),
                    CommentId = table.Column<Guid>(type: "uuid", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AlarmResetCommentTranslates", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AlarmResetCommentTranslates_AlarmResetComments_CommentId",
                        column: x => x.CommentId,
                        principalTable: "AlarmResetComments",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AlarmResetComments_OrganizationId",
                table: "AlarmResetComments",
                column: "OrganizationId");

            migrationBuilder.CreateIndex(
                name: "IX_AlarmResetCommentTranslates_CommentId",
                table: "AlarmResetCommentTranslates",
                column: "CommentId");
        }

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

            migrationBuilder.DropTable(
                name: "AlarmResetComments");
        }
    }
}
