/*
  Warnings:

  - You are about to drop the `LifeCycleTransaction` table. If the table is not empty, all the data it contains will be lost.

*/
-- DropForeignKey
ALTER TABLE "LifeCycleTransaction" DROP CONSTRAINT "LifeCycleTransaction_wallet_id_fkey";

-- DropTable
DROP TABLE "LifeCycleTransaction";

-- CreateTable
CREATE TABLE "LifeCycleTransactionHistory" (
    "id" TEXT NOT NULL,
    "wallet_id" TEXT NOT NULL,
    "amount" DECIMAL(65,30) NOT NULL,
    "transaction_type" TEXT NOT NULL DEFAULT 'lifecycle',
    "transaction_reason" "TransactionReason" NOT NULL DEFAULT 'debit',
    "status" "TransactionStatus" NOT NULL DEFAULT 'pending',
    "description" TEXT,
    "metadata" JSONB,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "sender_wallet_id" TEXT,
    "receiver_wallet_id" TEXT,

    CONSTRAINT "LifeCycleTransactionHistory_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "LifeCycleTransactionHistory" ADD CONSTRAINT "LifeCycleTransactionHistory_wallet_id_fkey" FOREIGN KEY ("wallet_id") REFERENCES "Wallet"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
