using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ColaFlow.Modules.ProjectManagement.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddTenantIdToEpicStoryTask : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "tenant_id",
                schema: "project_management",
                table: "Tasks",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "tenant_id",
                schema: "project_management",
                table: "Stories",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "tenant_id",
                schema: "project_management",
                table: "Epics",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateIndex(
                name: "ix_tasks_tenant_id",
                schema: "project_management",
                table: "Tasks",
                column: "tenant_id");

            migrationBuilder.CreateIndex(
                name: "ix_stories_tenant_id",
                schema: "project_management",
                table: "Stories",
                column: "tenant_id");

            migrationBuilder.CreateIndex(
                name: "ix_epics_tenant_id",
                schema: "project_management",
                table: "Epics",
                column: "tenant_id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "ix_tasks_tenant_id",
                schema: "project_management",
                table: "Tasks");

            migrationBuilder.DropIndex(
                name: "ix_stories_tenant_id",
                schema: "project_management",
                table: "Stories");

            migrationBuilder.DropIndex(
                name: "ix_epics_tenant_id",
                schema: "project_management",
                table: "Epics");

            migrationBuilder.DropColumn(
                name: "tenant_id",
                schema: "project_management",
                table: "Tasks");

            migrationBuilder.DropColumn(
                name: "tenant_id",
                schema: "project_management",
                table: "Stories");

            migrationBuilder.DropColumn(
                name: "tenant_id",
                schema: "project_management",
                table: "Epics");
        }
    }
}
