-- Add persisted per-sale Cashi Points earned
ALTER TABLE "sales" ADD COLUMN     "cashiPointsEarned" INTEGER NOT NULL DEFAULT 0;

-- Backfill existing rows (payable amount stored in `amount`)
UPDATE "sales"
SET "cashiPointsEarned" = COALESCE("amount", 0)
WHERE "cashiPointsEarned" = 0;

