using System;
using System.Collections.Generic;
using DysonNetwork.Shared.Models;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Insight.Migrations
{
    /// 
    public partial class AddThinkingThought : Migration
    {
        /// 
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "thinking_sequences",
                columns: table => new
                {
                    id = table.Column(type: "uuid", nullable: false),
                    topic = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true),
                    account_id = table.Column(type: "uuid", nullable: false),
                    created_at = table.Column(type: "timestamp with time zone", nullable: false),
                    updated_at = table.Column(type: "timestamp with time zone", nullable: false),
                    deleted_at = table.Column(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_thinking_sequences", x => x.id);
                });
            migrationBuilder.CreateTable(
                name: "thinking_thoughts",
                columns: table => new
                {
                    id = table.Column(type: "uuid", nullable: false),
                    content = table.Column(type: "text", nullable: true),
                    files = table.Column>(type: "jsonb", nullable: false),
                    role = table.Column(type: "integer", nullable: false),
                    sequence_id = table.Column(type: "uuid", nullable: false),
                    created_at = table.Column(type: "timestamp with time zone", nullable: false),
                    updated_at = table.Column(type: "timestamp with time zone", nullable: false),
                    deleted_at = table.Column(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_thinking_thoughts", x => x.id);
                    table.ForeignKey(
                        name: "fk_thinking_thoughts_thinking_sequences_sequence_id",
                        column: x => x.sequence_id,
                        principalTable: "thinking_sequences",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                });
            migrationBuilder.CreateIndex(
                name: "ix_thinking_thoughts_sequence_id",
                table: "thinking_thoughts",
                column: "sequence_id");
        }
        /// 
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "thinking_thoughts");
            migrationBuilder.DropTable(
                name: "thinking_sequences");
        }
    }
}