DO $$ BEGIN
  CREATE TYPE "adjustment_type" AS ENUM ('cash_in', 'cash_out');
EXCEPTION WHEN duplicate_object THEN NULL;
END $$;

CREATE TABLE IF NOT EXISTS "drawer_adjustment" (
  "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
  "drawer_session_id" uuid NOT NULL REFERENCES "drawer_session"("id"),
  "type" "adjustment_type" NOT NULL,
  "amount" numeric(10, 2) NOT NULL,
  "reason" text NOT NULL,
  "created_by" uuid NOT NULL REFERENCES "user"("id"),
  "created_at" timestamp with time zone DEFAULT now() NOT NULL
);
