-- CreateTable
CREATE TABLE "deposit_order_audit_logs" (
    "id" BIGSERIAL NOT NULL,
    "deposit_order_id" BIGINT NOT NULL,
    "action" VARCHAR(32) NOT NULL,
    "actor_id" BIGINT,
    "actor_type" VARCHAR(20) NOT NULL,
    "status_before" VARCHAR(20),
    "status_after" VARCHAR(20) NOT NULL,
    "amount" DECIMAL(18,4),
    "approved_amount" DECIMAL(18,4),
    "remark" VARCHAR(500),
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

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

-- CreateIndex
CREATE INDEX "deposit_order_audit_logs_deposit_order_id_idx" ON "deposit_order_audit_logs"("deposit_order_id");

-- CreateIndex
CREATE INDEX "deposit_order_audit_logs_created_at_idx" ON "deposit_order_audit_logs"("created_at");

-- AddForeignKey
ALTER TABLE "deposit_order_audit_logs" ADD CONSTRAINT "deposit_order_audit_logs_deposit_order_id_fkey" FOREIGN KEY ("deposit_order_id") REFERENCES "deposit_orders"("id") ON DELETE CASCADE ON UPDATE CASCADE;
