using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
    /// <inheritdoc />
    public partial class u10 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Transactionss_UserOrders_OrderId",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropForeignKey(
                name: "FK_UserOrders_Packages_PackageId",
                schema: "CMS",
                table: "UserOrders");

            migrationBuilder.DropForeignKey(
                name: "FK_UserOrders_UserAddresss_UserAddressId",
                schema: "CMS",
                table: "UserOrders");

            migrationBuilder.DropIndex(
                name: "IX_Transactionss_OrderId",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "Authority",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "CallbackUrl",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "CardHash",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "CardPan",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "Currency",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "Email",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "Fee",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "FeeType",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "MerchantId",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "Mobile",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "OrderId",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "RequestStatusCode",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "RequestStatusMessage",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "VerificationStatusCode",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.DropColumn(
                name: "VerificationStatusMessage",
                schema: "CMS",
                table: "Transactionss");

            migrationBuilder.RenameColumn(
                name: "Price",
                schema: "CMS",
                table: "UserOrders",
                newName: "Amount");

            migrationBuilder.AlterColumn<long>(
                name: "PackageId",
                schema: "CMS",
                table: "UserOrders",
                type: "bigint",
                nullable: true,
                oldClrType: typeof(long),
                oldType: "bigint");

            migrationBuilder.CreateIndex(
                name: "IX_UserOrders_TransactionId",
                schema: "CMS",
                table: "UserOrders",
                column: "TransactionId");

            migrationBuilder.AddForeignKey(
                name: "FK_UserOrders_Packages_PackageId",
                schema: "CMS",
                table: "UserOrders",
                column: "PackageId",
                principalSchema: "CMS",
                principalTable: "Packages",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_UserOrders_Transactionss_TransactionId",
                schema: "CMS",
                table: "UserOrders",
                column: "TransactionId",
                principalSchema: "CMS",
                principalTable: "Transactionss",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_UserOrders_UserAddresss_UserAddressId",
                schema: "CMS",
                table: "UserOrders",
                column: "UserAddressId",
                principalSchema: "CMS",
                principalTable: "UserAddresss",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_UserOrders_Packages_PackageId",
                schema: "CMS",
                table: "UserOrders");

            migrationBuilder.DropForeignKey(
                name: "FK_UserOrders_Transactionss_TransactionId",
                schema: "CMS",
                table: "UserOrders");

            migrationBuilder.DropForeignKey(
                name: "FK_UserOrders_UserAddresss_UserAddressId",
                schema: "CMS",
                table: "UserOrders");

            migrationBuilder.DropIndex(
                name: "IX_UserOrders_TransactionId",
                schema: "CMS",
                table: "UserOrders");

            migrationBuilder.RenameColumn(
                name: "Amount",
                schema: "CMS",
                table: "UserOrders",
                newName: "Price");

            migrationBuilder.AlterColumn<long>(
                name: "PackageId",
                schema: "CMS",
                table: "UserOrders",
                type: "bigint",
                nullable: false,
                defaultValue: 0L,
                oldClrType: typeof(long),
                oldType: "bigint",
                oldNullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Authority",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CallbackUrl",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "CardHash",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CardPan",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Currency",
                schema: "CMS",
                table: "Transactionss",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Email",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "Fee",
                schema: "CMS",
                table: "Transactionss",
                type: "bigint",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "FeeType",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "MerchantId",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "Mobile",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "OrderId",
                schema: "CMS",
                table: "Transactionss",
                type: "bigint",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "RequestStatusCode",
                schema: "CMS",
                table: "Transactionss",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "RequestStatusMessage",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "VerificationStatusCode",
                schema: "CMS",
                table: "Transactionss",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "VerificationStatusMessage",
                schema: "CMS",
                table: "Transactionss",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Transactionss_OrderId",
                schema: "CMS",
                table: "Transactionss",
                column: "OrderId");

            migrationBuilder.AddForeignKey(
                name: "FK_Transactionss_UserOrders_OrderId",
                schema: "CMS",
                table: "Transactionss",
                column: "OrderId",
                principalSchema: "CMS",
                principalTable: "UserOrders",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_UserOrders_Packages_PackageId",
                schema: "CMS",
                table: "UserOrders",
                column: "PackageId",
                principalSchema: "CMS",
                principalTable: "Packages",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_UserOrders_UserAddresss_UserAddressId",
                schema: "CMS",
                table: "UserOrders",
                column: "UserAddressId",
                principalSchema: "CMS",
                principalTable: "UserAddresss",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
