using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Pass.Migrations
{
    /// 
    public partial class AddLotteries : Migration
    {
        /// 
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "lotteries",
                columns: table => new
                {
                    id = table.Column(type: "uuid", nullable: false),
                    account_id = table.Column(type: "uuid", nullable: false),
                    region_one_numbers = table.Column>(type: "jsonb", nullable: false),
                    region_two_number = table.Column(type: "integer", nullable: false),
                    multiplier = table.Column(type: "integer", nullable: false),
                    draw_status = table.Column(type: "integer", nullable: false),
                    draw_date = table.Column(type: "timestamp with time zone", nullable: true),
                    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_lotteries", x => x.id);
                    table.ForeignKey(
                        name: "fk_lotteries_accounts_account_id",
                        column: x => x.account_id,
                        principalTable: "accounts",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                });
            migrationBuilder.CreateTable(
                name: "lottery_records",
                columns: table => new
                {
                    id = table.Column(type: "uuid", nullable: false),
                    draw_date = table.Column(type: "timestamp with time zone", nullable: false),
                    winning_region_one_numbers = table.Column>(type: "jsonb", nullable: false),
                    winning_region_two_number = table.Column(type: "integer", nullable: false),
                    total_tickets = table.Column(type: "integer", nullable: false),
                    total_prizes_awarded = table.Column(type: "integer", nullable: false),
                    total_prize_amount = table.Column(type: "bigint", 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_lottery_records", x => x.id);
                });
            migrationBuilder.CreateIndex(
                name: "ix_lotteries_account_id",
                table: "lotteries",
                column: "account_id");
        }
        /// 
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "lotteries");
            migrationBuilder.DropTable(
                name: "lottery_records");
        }
    }
}