-- CreateTable
CREATE TABLE "p2p_transfers" (
    "id" TEXT NOT NULL,
    "transfer_no" TEXT NOT NULL,
    "from_account_sequence" TEXT NOT NULL,
    "to_account_sequence" TEXT NOT NULL,
    "to_phone" TEXT NOT NULL,
    "to_nickname" TEXT,
    "from_phone" TEXT,
    "from_nickname" TEXT,
    "amount" DECIMAL(30,8) NOT NULL,
    "memo" TEXT,
    "status" TEXT NOT NULL DEFAULT 'PENDING',
    "error_message" TEXT,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "completed_at" TIMESTAMP(3),

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

-- CreateIndex
CREATE UNIQUE INDEX "p2p_transfers_transfer_no_key" ON "p2p_transfers"("transfer_no");

-- CreateIndex
CREATE INDEX "p2p_transfers_from_account_sequence_idx" ON "p2p_transfers"("from_account_sequence");

-- CreateIndex
CREATE INDEX "p2p_transfers_to_account_sequence_idx" ON "p2p_transfers"("to_account_sequence");

-- CreateIndex
CREATE INDEX "p2p_transfers_status_idx" ON "p2p_transfers"("status");

-- CreateIndex
CREATE INDEX "p2p_transfers_created_at_idx" ON "p2p_transfers"("created_at" DESC);
