using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AsbCloudDb.Migrations
{
    public partial class Add_user_settings : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "t_user_settings",
                columns: table => new
                {
                    idUser = table.Column<int>(type: "integer", nullable: false),
                    key = table.Column<string>(type: "text", nullable: false, comment: "Ключ настроек пользователя"),
                    setting_value = table.Column<object>(type: "jsonb", nullable: true, comment: "Значение настроек пользователя")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_user_settings", x => new { x.idUser, x.key });
                    table.ForeignKey(
                        name: "FK_t_user_settings_t_user_idUser",
                        column: x => x.idUser,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "настройки интерфейса пользователя");
        }

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