-- CreateTable
CREATE TABLE "offline_settlement_deductions" (
    "deduction_id" BIGSERIAL NOT NULL,
    "account_sequence" VARCHAR(20) NOT NULL,
    "user_id" BIGINT NOT NULL,
    "original_ledger_entry_id" BIGINT NOT NULL,
    "original_amount" DECIMAL(20,8) NOT NULL,
    "deducted_amount" DECIMAL(20,8) NOT NULL,
    "deduction_ledger_entry_id" BIGINT NOT NULL,
    "deduction_order_no" VARCHAR(50) NOT NULL,
    "pending_action_id" VARCHAR(100),
    "operator_id" VARCHAR(100) NOT NULL,
    "memo" VARCHAR(500),
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "offline_settlement_deductions_pkey" PRIMARY KEY ("deduction_id")
);

-- CreateIndex
CREATE UNIQUE INDEX "offline_settlement_deductions_original_ledger_entry_id_key" ON "offline_settlement_deductions"("original_ledger_entry_id");

-- CreateIndex
CREATE INDEX "offline_settlement_deductions_account_sequence_idx" ON "offline_settlement_deductions"("account_sequence");

-- CreateIndex
CREATE INDEX "offline_settlement_deductions_user_id_idx" ON "offline_settlement_deductions"("user_id");

-- CreateIndex
CREATE INDEX "offline_settlement_deductions_pending_action_id_idx" ON "offline_settlement_deductions"("pending_action_id");

-- CreateIndex
CREATE INDEX "offline_settlement_deductions_deduction_order_no_idx" ON "offline_settlement_deductions"("deduction_order_no");

-- CreateIndex
CREATE INDEX "offline_settlement_deductions_created_at_idx" ON "offline_settlement_deductions"("created_at");
