<?xml version="1.0" encoding="UTF-8"?>
<adr xmlns="urn:xenon:adr"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xml:id="adr-0001" status="accepted">
  <dc:identifier>ADR-0001</dc:identifier>
  <dc:title>Primary datastore and key format</dc:title>
  <dc:creator>Priya Nair</dc:creator>
  <dc:date>2025-01-14</dc:date>
  <context>
    <p>The Order Service needs transactional storage for orders, lines and
       payments, and a key format that other services can generate safely.</p>
  </context>
  <decisions>
    <decision xml:id="adr-0001-d1" subject="persistence">
      <statement>PostgreSQL 16 is the primary datastore for the Order Service.</statement>
      <rationale>The team already operates Postgres, and orders need
        multi-row transactions.</rationale>
    </decision>
    <decision xml:id="adr-0001-d2" subject="identifiers">
      <statement>Primary keys are UUIDv4, generated by the application.</statement>
      <rationale>Clients can create IDs before the first write.</rationale>
    </decision>
  </decisions>
  <consequences>
    <p>Random UUIDv4 keys will fragment B-tree indexes as tables grow.</p>
  </consequences>
</adr>
