CREATE TABLE "ExternalBusinessExpense" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "shopId" TEXT NOT NULL,
    "createdById" TEXT NOT NULL,
    "expenseDate" DATETIME NOT NULL,
    "category" TEXT NOT NULL,
    "description" TEXT NOT NULL,
    "amount" REAL NOT NULL,
    "affectsProfit" BOOLEAN NOT NULL DEFAULT true,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL
);

CREATE INDEX "ExternalBusinessExpense_shopId_expenseDate_idx" ON "ExternalBusinessExpense"("shopId", "expenseDate");
CREATE INDEX "ExternalBusinessExpense_createdById_expenseDate_idx" ON "ExternalBusinessExpense"("createdById", "expenseDate");
