<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<database name="revique" schema="public" type="PostgreSQL - 16.15 (Debian 16.15-1.pgdg13+2)">
   <tables>
      <table name="catalog_item_location_pricing" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="catalog_item_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="catalog_item_location_pricing_catalog_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="catalog_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="0" digits="0" id="3" name="cash_price_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="card_price_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="5" name="unit_price_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="cost_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="overhead_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="discount_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="4" id="9" name="discount_percent" nullable="true" remarks="" size="7" type="numeric" typeCode="2"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="discount_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="0" digits="4" id="11" name="tax_percent" nullable="false" remarks="" size="7" type="numeric" typeCode="2"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="12" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="13" name="is_deleted" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="14" name="legacy_practice_location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="15" name="legacy_payload" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="16" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="17" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="catalog_item_location_pricing_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="catalog_item_location_pricing_catalog_item_id_practice_loca_key" unique="true">
            <column ascending="true" name="catalog_item_id"/>
            <column ascending="true" name="practice_location_id"/>
         </index>
         <index name="catalog_item_location_pricing_global_unique" unique="true">
            <column ascending="true" name="catalog_item_id"/>
         </index>
         <index name="catalog_item_location_pricing_item_idx" unique="false">
            <column ascending="true" name="catalog_item_id"/>
         </index>
         <index name="catalog_item_location_pricing_location_active_idx" unique="false">
            <column ascending="true" name="practice_location_id"/>
            <column ascending="true" name="is_active"/>
         </index>
         <index name="catalog_item_location_pricing_location_unique" unique="true">
            <column ascending="true" name="catalog_item_id"/>
            <column ascending="true" name="practice_location_id"/>
         </index>
         <checkConstraint constraint="(((card_price_cents IS NULL) OR (card_price_cents &gt;= 0)))" name="catalog_item_location_pricing_card_price_cents_check"/>
         <checkConstraint constraint="((cash_price_cents &gt;= 0))" name="catalog_item_location_pricing_cash_price_cents_check"/>
         <checkConstraint constraint="(((cost_cents IS NULL) OR (cost_cents &gt;= 0)))" name="catalog_item_location_pricing_cost_cents_check"/>
         <checkConstraint constraint="(((discount_cents IS NULL) OR (discount_cents &gt;= 0)))" name="catalog_item_location_pricing_discount_cents_check"/>
         <checkConstraint constraint="(((discount_percent IS NULL) OR ((discount_percent &gt;= (0)::numeric) AND (discount_percent &lt;= (100)::numeric))))" name="catalog_item_location_pricing_discount_percent_check"/>
         <checkConstraint constraint="(((discount_type IS NULL) OR (discount_type = ANY (ARRAY['amount'::text, 'percent'::text]))))" name="catalog_item_location_pricing_discount_type_check"/>
         <checkConstraint constraint="(((overhead_cents IS NULL) OR (overhead_cents &gt;= 0)))" name="catalog_item_location_pricing_overhead_cents_check"/>
         <checkConstraint constraint="((tax_percent &gt;= (0)::numeric))" name="catalog_item_location_pricing_tax_percent_check"/>
         <checkConstraint constraint="((unit_price_cents &gt;= 0))" name="catalog_item_location_pricing_unit_price_cents_check"/>
      </table>
      <table name="catalog_item_lots" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="catalog_item_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="catalog_item_lots_catalog_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="catalog_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_location_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="lot_number" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="expiration_date" nullable="true" remarks="" size="13" type="date" typeCode="91"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="received_quantity" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="remaining_quantity" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="received_on" nullable="true" remarks="" size="13" type="date" typeCode="91"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="8" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="legacy_item_lot_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="10" name="legacy_payload" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="11" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="catalog_item_lots_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="catalog_item_lots_item_idx" unique="false">
            <column ascending="true" name="catalog_item_id"/>
         </index>
         <index name="catalog_item_lots_item_location_lot_number_idx" unique="false">
            <column ascending="true" name="catalog_item_id"/>
            <column ascending="true" name="practice_location_id"/>
            <column ascending="true" name="lot_number"/>
         </index>
         <index name="catalog_item_lots_legacy_unique" unique="true">
            <column ascending="true" name="legacy_item_lot_id"/>
         </index>
         <index name="catalog_item_lots_location_active_idx" unique="false">
            <column ascending="true" name="practice_location_id"/>
            <column ascending="true" name="is_active"/>
            <column ascending="true" name="remaining_quantity"/>
         </index>
         <checkConstraint constraint="((remaining_quantity &lt;= received_quantity))" name="catalog_item_lots_check"/>
         <checkConstraint constraint="((received_quantity &gt; 0))" name="catalog_item_lots_received_quantity_check"/>
         <checkConstraint constraint="((remaining_quantity &gt;= 0))" name="catalog_item_lots_remaining_quantity_check"/>
      </table>
      <table name="catalog_item_provider_mappings" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="catalog_item_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="catalog_item_provider_mappings_catalog_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="catalog_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="provider_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="practice_location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="true" digits="0" id="4" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="legacy_provider_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="6" name="legacy_payload" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="catalog_item_provider_mappings_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="catalog_item_provider_mappings_global_unique" unique="true">
            <column ascending="true" name="catalog_item_id"/>
            <column ascending="true" name="provider_id"/>
         </index>
         <index name="catalog_item_provider_mappings_location_unique" unique="true">
            <column ascending="true" name="catalog_item_id"/>
            <column ascending="true" name="provider_id"/>
            <column ascending="true" name="practice_location_id"/>
         </index>
         <index name="catalog_item_provider_mappings_provider_idx" unique="false">
            <column ascending="true" name="provider_id"/>
            <column ascending="true" name="is_active"/>
         </index>
      </table>
      <table name="catalog_items" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="catalog_item_id" foreignKey="catalog_item_location_pricing_catalog_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="catalog_item_location_pricing"/>
            <child column="catalog_item_id" foreignKey="catalog_item_lots_catalog_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="catalog_item_lots"/>
            <child column="catalog_item_id" foreignKey="catalog_item_provider_mappings_catalog_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="catalog_item_provider_mappings"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="sku" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="upc" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="manufacturer_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="manufacturer_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="service_code" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="service_duration_minutes" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="11" name="is_procedural" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="12" name="is_lot_tracked" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="13" name="is_taxable" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="14" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="15" name="is_deleted" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="16" name="legacy_item_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="17" name="legacy_service_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="18" name="legacy_practice_service_type_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="19" name="legacy_fee_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="20" name="legacy_item_type" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="21" name="legacy_payload" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="22" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="23" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="24" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="catalog_items_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="catalog_items_legacy_fee_unique" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="kind"/>
            <column ascending="true" name="legacy_fee_id"/>
         </index>
         <index name="catalog_items_legacy_item_unique" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="kind"/>
            <column ascending="true" name="legacy_item_id"/>
         </index>
         <index name="catalog_items_legacy_service_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="kind"/>
            <column ascending="true" name="legacy_service_id"/>
         </index>
         <index name="catalog_items_practice_kind_active_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="kind"/>
            <column ascending="true" name="is_active"/>
         </index>
         <index name="catalog_items_practice_name_idx" unique="false">
            <column ascending="true" name="practice_id"/>
         </index>
         <index name="catalog_items_sku_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="sku"/>
         </index>
         <index name="catalog_items_upc_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="upc"/>
         </index>
         <checkConstraint constraint="((kind = ANY (ARRAY['product'::text, 'service'::text, 'fee'::text])))" name="catalog_items_kind_check"/>
         <checkConstraint constraint="(((service_duration_minutes IS NULL) OR (service_duration_minutes &gt; 0)))" name="catalog_items_service_duration_minutes_check"/>
      </table>
      <table name="gift_card_definition_locations" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="gift_card_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="gift_card_definition_locations_gift_card_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="gift_card_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_location_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="true" digits="0" id="3" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="4" name="taxable" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="gift_card_definition_locations_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="gift_card_definition_location_gift_card_definition_id_pract_key" unique="true">
            <column ascending="true" name="gift_card_definition_id"/>
            <column ascending="true" name="practice_location_id"/>
         </index>
         <index name="gift_card_definition_locations_definition_idx" unique="false">
            <column ascending="true" name="gift_card_definition_id"/>
         </index>
         <index name="gift_card_definition_locations_location_idx" unique="false">
            <column ascending="true" name="practice_location_id"/>
            <column ascending="true" name="is_active"/>
         </index>
      </table>
      <table name="gift_card_definitions" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="gift_card_definition_id" foreignKey="gift_card_definition_locations_gift_card_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="gift_card_definition_locations"/>
            <child column="gift_card_definition_id" foreignKey="gift_cards_gift_card_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="gift_cards"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="amount_mode" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="fixed_amount_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'USD'::bpchar" digits="0" id="6" name="currency_code" nullable="false" remarks="" size="3" type="bpchar" typeCode="1"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="image_url" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="image_alt_text" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="9" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="10" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="11" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="gift_card_definitions_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="gift_card_definitions_practice_active_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="is_active"/>
         </index>
         <index name="gift_card_definitions_practice_name_unique" unique="true">
            <column ascending="true" name="practice_id"/>
         </index>
         <checkConstraint constraint="((amount_mode = ANY (ARRAY['fixed'::text, 'custom'::text])))" name="gift_card_definitions_amount_mode_check"/>
         <checkConstraint constraint="((((amount_mode = 'fixed'::text) AND (fixed_amount_cents IS NOT NULL)) OR ((amount_mode = 'custom'::text) AND (fixed_amount_cents IS NULL))))" name="gift_card_definitions_check"/>
         <checkConstraint constraint="((currency_code ~ '^[A-Z]{3}$'::text))" name="gift_card_definitions_currency_code_check"/>
         <checkConstraint constraint="(((fixed_amount_cents IS NULL) OR (fixed_amount_cents &gt; 0)))" name="gift_card_definitions_fixed_amount_cents_check"/>
      </table>
      <table name="gift_card_ledger_entries" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="gift_card_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="gift_card_ledger_entries_gift_card_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="gift_cards"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="event_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="amount_delta_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="balance_after_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="source_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="source_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="7" name="source_context" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="actor_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="reason" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="idempotency_key" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="11" name="occurred_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="gift_card_ledger_entries_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="gift_card_ledger_entries_card_idx" unique="false">
            <column ascending="true" name="gift_card_id"/>
            <column ascending="false" name="occurred_at"/>
         </index>
         <index name="gift_card_ledger_entries_idempotency_unique" unique="true">
            <column ascending="true" name="idempotency_key"/>
         </index>
         <index name="gift_card_ledger_entries_source_idx" unique="false">
            <column ascending="true" name="source_kind"/>
            <column ascending="true" name="source_id"/>
         </index>
         <checkConstraint constraint="((balance_after_cents &gt;= 0))" name="gift_card_ledger_entries_balance_after_cents_check"/>
         <checkConstraint constraint="((((event_kind = ANY (ARRAY['issue'::text, 'reload'::text])) AND (amount_delta_cents &gt; 0)) OR ((event_kind = ANY (ARRAY['redemption'::text, 'void'::text, 'refund'::text])) AND (amount_delta_cents &lt; 0)) OR ((event_kind = 'adjustment'::text) AND (amount_delta_cents &lt;&gt; 0))))" name="gift_card_ledger_entries_check"/>
         <checkConstraint constraint="((event_kind = ANY (ARRAY['issue'::text, 'redemption'::text, 'reload'::text, 'adjustment'::text, 'void'::text, 'refund'::text])))" name="gift_card_ledger_entries_event_kind_check"/>
         <checkConstraint constraint="((source_kind = ANY (ARRAY['checkout'::text, 'invoice'::text, 'payment'::text, 'manual'::text, 'system'::text])))" name="gift_card_ledger_entries_source_kind_check"/>
      </table>
      <table name="gift_cards" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="gift_card_id" foreignKey="gift_card_ledger_entries_gift_card_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="gift_card_ledger_entries"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="gift_card_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="gift_cards_gift_card_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="gift_card_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="patient_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="location_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="card_number" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="card_number_hash" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="card_number_last4" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="original_amount_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="current_balance_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'USD'::bpchar" digits="0" id="10" name="currency_code" nullable="false" remarks="" size="3" type="bpchar" typeCode="1"/>
         <column autoUpdated="false" defaultValue="'active'::text" digits="0" id="11" name="status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="issued_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="13" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="gift_cards_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="gift_cards_definition_idx" unique="false">
            <column ascending="true" name="gift_card_definition_id"/>
         </index>
         <index name="gift_cards_number_hash_unique" unique="true">
            <column ascending="true" name="card_number_hash"/>
         </index>
         <index name="gift_cards_patient_status_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="true" name="status"/>
         </index>
         <checkConstraint constraint="((current_balance_cents &lt;= original_amount_cents))" name="gift_cards_check"/>
         <checkConstraint constraint="((currency_code ~ '^[A-Z]{3}$'::text))" name="gift_cards_currency_code_check"/>
         <checkConstraint constraint="((current_balance_cents &gt;= 0))" name="gift_cards_current_balance_cents_check"/>
         <checkConstraint constraint="((original_amount_cents &gt; 0))" name="gift_cards_original_amount_cents_check"/>
         <checkConstraint constraint="((status = ANY (ARRAY['active'::text, 'exhausted'::text, 'voided'::text, 'refunded'::text])))" name="gift_cards_status_check"/>
      </table>
      <table name="loyalty_point_adjustments" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="loyalty_profile_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="loyalty_point_adjustments_loyalty_profile_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="loyalty_profiles"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="points_delta" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="points_balance_after" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="reason" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="actor_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="occurred_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="source_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="source_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="eligible_amount_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="loyalty_point_adjustments_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="loyalty_point_adjustments_profile_idx" unique="false">
            <column ascending="true" name="loyalty_profile_id"/>
            <column ascending="false" name="occurred_at"/>
         </index>
         <index name="loyalty_point_adjustments_source_idx" unique="false">
            <column ascending="true" name="source_type"/>
            <column ascending="true" name="source_id"/>
         </index>
         <index name="loyalty_point_adjustments_source_unique" unique="true">
            <column ascending="true" name="loyalty_profile_id"/>
            <column ascending="true" name="source_type"/>
            <column ascending="true" name="source_id"/>
         </index>
         <checkConstraint constraint="(((eligible_amount_cents IS NULL) OR (eligible_amount_cents &gt;= 0)))" name="loyalty_point_adjustments_eligible_amount_cents_check"/>
         <checkConstraint constraint="((points_balance_after &gt;= 0))" name="loyalty_point_adjustments_points_balance_after_check"/>
         <checkConstraint constraint="((points_delta &lt;&gt; 0))" name="loyalty_point_adjustments_points_delta_check"/>
      </table>
      <table name="loyalty_profiles" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="loyalty_profile_id" foreignKey="loyalty_point_adjustments_loyalty_profile_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="loyalty_point_adjustments"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="patient_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'colorscience'::text" digits="0" id="3" name="program_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'registered'::text" digits="0" id="4" name="status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="5" name="points_balance" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="first_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="last_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="email" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="phone" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="postal_code" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="birth_month" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="12" name="birth_day" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="13" name="consented_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="registered_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="15" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="16" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="loyalty_profiles_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="loyalty_profiles_patient_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
         </index>
         <index name="loyalty_profiles_practice_id_patient_id_program_key_key" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="true" name="program_key"/>
         </index>
         <index name="loyalty_profiles_program_status_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="program_key"/>
            <column ascending="true" name="status"/>
         </index>
         <checkConstraint constraint="(((birth_day IS NULL) OR ((birth_day &gt;= 1) AND (birth_day &lt;= 31))))" name="loyalty_profiles_birth_day_check"/>
         <checkConstraint constraint="(((birth_month IS NULL) OR ((birth_month &gt;= 1) AND (birth_month &lt;= 12))))" name="loyalty_profiles_birth_month_check"/>
         <checkConstraint constraint="((points_balance &gt;= 0))" name="loyalty_profiles_points_balance_check"/>
         <checkConstraint constraint="((status = ANY (ARRAY['registered'::text, 'inactive'::text])))" name="loyalty_profiles_status_check"/>
      </table>
      <table name="loyalty_program_products" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="'colorscience'::text" digits="0" id="1" name="program_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="sku" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="upc" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="5" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="6" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="loyalty_program_products_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="loyalty_program_products_program_active_idx" unique="false">
            <column ascending="true" name="program_key"/>
            <column ascending="true" name="is_active"/>
         </index>
         <index name="loyalty_program_products_program_key_sku_key" unique="true">
            <column ascending="true" name="program_key"/>
            <column ascending="true" name="sku"/>
         </index>
         <index name="loyalty_program_products_upc_idx" unique="false">
            <column ascending="true" name="program_key"/>
            <column ascending="true" name="upc"/>
         </index>
         <checkConstraint constraint="((sku &lt;&gt; ''::text))" name="loyalty_program_products_sku_check"/>
         <checkConstraint constraint="(((upc IS NULL) OR (upc ~ '^[0-9]+$'::text)))" name="loyalty_program_products_upc_check"/>
      </table>
      <table name="native_payment_transactions" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="patient_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="invoice_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="checkout_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="payment_gateway_config_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="native_payment_transactions_payment_gateway_config_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="payment_gateway_configs"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="gateway" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="gateway_environment" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="payment_method_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="amount_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'USD'::bpchar" digits="0" id="11" name="currency_code" nullable="false" remarks="" size="3" type="bpchar" typeCode="1"/>
         <column autoUpdated="false" defaultValue="'pending'::text" digits="0" id="12" name="status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="13" name="idempotency_key" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="14" name="gateway_idempotency_key" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="15" name="gateway_transaction_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="16" name="gateway_status" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="17" name="gateway_response" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="18" name="gateway_response_code" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="19" name="gateway_response_message" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="20" name="processor_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="6" id="21" name="submitted_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="22" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="23" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="24" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="native_payment_transactions_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="native_payment_transactions_gateway_idx" unique="false">
            <column ascending="true" name="gateway"/>
            <column ascending="true" name="gateway_transaction_id"/>
         </index>
         <index name="native_payment_transactions_idempotency_unique" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="idempotency_key"/>
         </index>
         <index name="native_payment_transactions_invoice_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="invoice_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <index name="native_payment_transactions_patient_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <checkConstraint constraint="((amount_cents &gt; 0))" name="native_payment_transactions_amount_cents_check"/>
         <checkConstraint constraint="((currency_code ~ '^[A-Z]{3}$'::text))" name="native_payment_transactions_currency_code_check"/>
         <checkConstraint constraint="((gateway = 'fluidpay'::text))" name="native_payment_transactions_gateway_check"/>
         <checkConstraint constraint="((gateway_environment = ANY (ARRAY['sandbox'::text, 'production'::text])))" name="native_payment_transactions_gateway_environment_check"/>
         <checkConstraint constraint="((payment_method_type = 'card_token'::text))" name="native_payment_transactions_payment_method_type_check"/>
         <checkConstraint constraint="((practice_id &lt;&gt; ''::text))" name="native_payment_transactions_practice_id_check"/>
         <checkConstraint constraint="((status = ANY (ARRAY['pending'::text, 'approved'::text, 'declined'::text, 'gateway_declined'::text, 'processor_error'::text, 'gateway_error'::text])))" name="native_payment_transactions_status_check"/>
      </table>
      <table name="notification_user_states" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="notification_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="notification_user_states_notification_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="notifications"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="user_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="read_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="4" name="dismissed_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="actioned_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="notification_user_states_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="notification_user_states_notification_id_user_id_key" unique="true">
            <column ascending="true" name="notification_id"/>
            <column ascending="true" name="user_id"/>
         </index>
         <index name="notification_user_states_user_idx" unique="false">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="dismissed_at"/>
            <column ascending="true" name="read_at"/>
         </index>
      </table>
      <table name="notifications" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="notification_id" foreignKey="notification_user_states_notification_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="notification_user_states"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="source_system" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="source_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="source_entity_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="source_entity_version" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="title" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="preview" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="body" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'normal'::text" digits="0" id="10" name="priority" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="11" name="target" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="12" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="13" name="occurred_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="15" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="notifications_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="notifications_practice_id_source_system_source_type_source__key" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="source_system"/>
            <column ascending="true" name="source_type"/>
            <column ascending="true" name="source_entity_id"/>
         </index>
         <index name="notifications_practice_location_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="location_id"/>
            <column ascending="false" name="occurred_at"/>
         </index>
         <index name="notifications_practice_occurred_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="false" name="occurred_at"/>
         </index>
         <index name="notifications_source_idx" unique="false">
            <column ascending="true" name="source_system"/>
            <column ascending="true" name="source_type"/>
            <column ascending="true" name="source_entity_id"/>
         </index>
         <checkConstraint constraint="((priority = ANY (ARRAY['low'::text, 'normal'::text, 'high'::text, 'urgent'::text])))" name="notifications_priority_check"/>
         <checkConstraint constraint="((source_system = ANY (ARRAY['legacy_hpt'::text, 'revique'::text])))" name="notifications_source_system_check"/>
         <checkConstraint constraint="((source_type = ANY (ARRAY['patient_message'::text, 'lead_message'::text, 'form_submission'::text, 'alert'::text])))" name="notifications_source_type_check"/>
      </table>
      <table name="package_definition_location_prices" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="package_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="package_definition_location_prices_package_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="package_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_location_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="price_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="4" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="package_definition_location_prices_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="package_definition_location_p_package_definition_id_practic_key" unique="true">
            <column ascending="true" name="package_definition_id"/>
            <column ascending="true" name="practice_location_id"/>
         </index>
         <index name="package_definition_location_prices_definition_idx" unique="false">
            <column ascending="true" name="package_definition_id"/>
         </index>
         <index name="package_definition_location_prices_location_idx" unique="false">
            <column ascending="true" name="practice_location_id"/>
            <column ascending="true" name="is_active"/>
         </index>
         <checkConstraint constraint="((price_cents &gt;= 0))" name="package_definition_location_prices_price_cents_check"/>
      </table>
      <table name="package_definitions" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="package_definition_id" foreignKey="package_definition_location_prices_package_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="package_definition_location_prices"/>
            <child column="package_definition_id" foreignKey="package_items_package_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="package_items"/>
            <child column="package_definition_id" foreignKey="package_ledger_entries_package_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_ledger_entries"/>
            <child column="package_definition_id" foreignKey="patient_package_instances_package_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="price_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'USD'::bpchar" digits="0" id="5" name="currency_code" nullable="false" remarks="" size="3" type="bpchar" typeCode="1"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="6" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="7" name="starts_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="expires_after_days" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="9" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="10" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="package_definitions_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="package_definitions_practice_active_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="is_active"/>
         </index>
         <index name="package_definitions_practice_name_unique" unique="true">
            <column ascending="true" name="practice_id"/>
         </index>
         <checkConstraint constraint="((currency_code ~ '^[A-Z]{3}$'::text))" name="package_definitions_currency_code_check"/>
         <checkConstraint constraint="(((expires_after_days IS NULL) OR (expires_after_days &gt; 0)))" name="package_definitions_expires_after_days_check"/>
         <checkConstraint constraint="((price_cents &gt;= 0))" name="package_definitions_price_cents_check"/>
      </table>
      <table name="package_items" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="package_item_id" foreignKey="package_ledger_entries_package_item_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_ledger_entries"/>
            <child column="package_item_id" foreignKey="patient_package_item_balances_package_item_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="patient_package_item_balances"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="package_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="package_items_package_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="package_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="catalog_item_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="catalog_item_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="catalog_item_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="quantity" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="package_items_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="package_items_definition_idx" unique="false">
            <column ascending="true" name="package_definition_id"/>
         </index>
         <index name="package_items_package_definition_id_catalog_item_kind_catal_key" unique="true">
            <column ascending="true" name="package_definition_id"/>
            <column ascending="true" name="catalog_item_kind"/>
            <column ascending="true" name="catalog_item_id"/>
         </index>
         <checkConstraint constraint="((catalog_item_kind = ANY (ARRAY['product'::text, 'service'::text])))" name="package_items_catalog_item_kind_check"/>
         <checkConstraint constraint="((quantity &gt; 0))" name="package_items_quantity_check"/>
      </table>
      <table name="package_ledger_entries" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="patient_package_instance_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="package_ledger_entries_patient_package_instance_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="patient_package_item_balance_id" nullable="true" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="package_ledger_entries_patient_package_item_balance_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="patient_package_item_balances"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="package_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="package_ledger_entries_package_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="package_item_id" nullable="true" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="package_ledger_entries_package_item_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="event_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="quantity_delta" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="remaining_quantity_after" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="source_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="source_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="10" name="source_context" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="actor_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="12" name="reason" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="13" name="idempotency_key" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="occurred_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="15" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="package_ledger_entries_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="package_ledger_entries_idempotency_unique" unique="true">
            <column ascending="true" name="idempotency_key"/>
         </index>
         <index name="package_ledger_entries_instance_idx" unique="false">
            <column ascending="true" name="patient_package_instance_id"/>
            <column ascending="true" name="occurred_at"/>
         </index>
         <index name="package_ledger_entries_source_idx" unique="false">
            <column ascending="true" name="source_kind"/>
            <column ascending="true" name="source_id"/>
         </index>
         <checkConstraint constraint="((((event_kind = 'purchase'::text) AND (quantity_delta &gt; 0)) OR ((event_kind = 'redemption'::text) AND (quantity_delta &lt; 0)) OR ((event_kind = ANY (ARRAY['void'::text, 'refund'::text, 'expiration'::text])) AND (quantity_delta &lt;= 0)) OR ((event_kind = 'adjustment'::text) AND (quantity_delta &lt;&gt; 0))))" name="package_ledger_entries_check"/>
         <checkConstraint constraint="((((patient_package_item_balance_id IS NULL) AND (remaining_quantity_after IS NULL)) OR ((patient_package_item_balance_id IS NOT NULL) AND (remaining_quantity_after IS NOT NULL))))" name="package_ledger_entries_check1"/>
         <checkConstraint constraint="((event_kind = ANY (ARRAY['purchase'::text, 'redemption'::text, 'adjustment'::text, 'void'::text, 'refund'::text, 'expiration'::text])))" name="package_ledger_entries_event_kind_check"/>
         <checkConstraint constraint="(((remaining_quantity_after IS NULL) OR (remaining_quantity_after &gt;= 0)))" name="package_ledger_entries_remaining_quantity_after_check"/>
         <checkConstraint constraint="((source_kind = ANY (ARRAY['checkout'::text, 'invoice'::text, 'payment'::text, 'manual'::text, 'system'::text, 'migration'::text])))" name="package_ledger_entries_source_kind_check"/>
      </table>
      <table name="patient_files" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="patient_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="category" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="file_name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="content_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="size_bytes" nullable="true" remarks="" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="'s3'::text" digits="0" id="7" name="storage_provider" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="object_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'pending'::text" digits="0" id="9" name="upload_status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="10" name="completed_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="created_by_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="6" id="12" name="deleted_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="13" name="deleted_by_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="14" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="15" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="16" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="patient_files_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="patient_files_patient_category_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="true" name="category"/>
            <column ascending="false" name="created_at"/>
         </index>
         <index name="patient_files_patient_uploaded_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <index name="patient_files_pending_idx" unique="false">
            <column ascending="true" name="created_at"/>
         </index>
         <index name="patient_files_storage_object_key_unique" unique="true">
            <column ascending="true" name="storage_provider"/>
            <column ascending="true" name="object_key"/>
         </index>
         <checkConstraint constraint="((category = ANY (ARRAY['documents'::text, 'photos'::text, 'media'::text])))" name="patient_files_category_check"/>
         <checkConstraint constraint="((file_name &lt;&gt; ''::text))" name="patient_files_file_name_check"/>
         <checkConstraint constraint="(((size_bytes IS NULL) OR (size_bytes &gt;= 0)))" name="patient_files_size_bytes_check"/>
         <checkConstraint constraint="((storage_provider = ANY (ARRAY['s3'::text, 'r2'::text])))" name="patient_files_storage_provider_check"/>
         <checkConstraint constraint="((upload_status = ANY (ARRAY['pending'::text, 'uploaded'::text])))" name="patient_files_upload_status_check"/>
      </table>
      <table name="patient_package_instances" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="patient_package_instance_id" foreignKey="package_ledger_entries_patient_package_instance_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_ledger_entries"/>
            <child column="patient_package_instance_id" foreignKey="patient_package_item_balances_patient_package_instance_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="patient_package_item_balances"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="package_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="patient_package_instances_package_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="patient_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="source_checkout_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="source_invoice_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="source_payment_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="purchased_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="9" name="expires_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="'active'::text" digits="0" id="10" name="status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="price_paid_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'USD'::bpchar" digits="0" id="12" name="currency_code" nullable="false" remarks="" size="3" type="bpchar" typeCode="1"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="13" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="patient_package_instances_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="patient_package_instances_expiry_idx" unique="false">
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="patient_package_instances_patient_status_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="true" name="status"/>
         </index>
         <checkConstraint constraint="(((expires_at IS NULL) OR (expires_at &gt; purchased_at)))" name="patient_package_instances_check"/>
         <checkConstraint constraint="((currency_code ~ '^[A-Z]{3}$'::text))" name="patient_package_instances_currency_code_check"/>
         <checkConstraint constraint="((price_paid_cents &gt;= 0))" name="patient_package_instances_price_paid_cents_check"/>
         <checkConstraint constraint="((status = ANY (ARRAY['active'::text, 'exhausted'::text, 'expired'::text, 'voided'::text, 'refunded'::text])))" name="patient_package_instances_status_check"/>
      </table>
      <table name="patient_package_item_balances" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="patient_package_item_balance_id" foreignKey="package_ledger_entries_patient_package_item_balance_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_ledger_entries"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="patient_package_instance_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="patient_package_item_balances_patient_package_instance_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="patient_package_instances"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="package_item_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="patient_package_item_balances_package_item_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="package_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="catalog_item_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="catalog_item_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="original_quantity" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="remaining_quantity" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="patient_package_item_balances_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="patient_package_item_balances_instance_idx" unique="false">
            <column ascending="true" name="patient_package_instance_id"/>
         </index>
         <index name="patient_package_item_balances_lookup_idx" unique="false">
            <column ascending="true" name="catalog_item_kind"/>
            <column ascending="true" name="catalog_item_id"/>
            <column ascending="true" name="remaining_quantity"/>
         </index>
         <index name="patient_package_item_balances_patient_package_instance_id_p_key" unique="true">
            <column ascending="true" name="patient_package_instance_id"/>
            <column ascending="true" name="package_item_id"/>
         </index>
         <checkConstraint constraint="((catalog_item_kind = ANY (ARRAY['product'::text, 'service'::text])))" name="patient_package_item_balances_catalog_item_kind_check"/>
         <checkConstraint constraint="((remaining_quantity &lt;= original_quantity))" name="patient_package_item_balances_check"/>
         <checkConstraint constraint="((original_quantity &gt; 0))" name="patient_package_item_balances_original_quantity_check"/>
         <checkConstraint constraint="((remaining_quantity &gt;= 0))" name="patient_package_item_balances_remaining_quantity_check"/>
      </table>
      <table name="patient_portal_accounts" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="account_id" foreignKey="patient_portal_provider_links_account_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="patient_portal_provider_links"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="legacy_patient_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="legacy_user_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="login_identifier_hash" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'active'::text" digits="0" id="4" name="status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="last_login_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="patient_portal_accounts_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="patient_portal_accounts_legacy_patient_id_key" unique="true">
            <column ascending="true" name="legacy_patient_id"/>
         </index>
         <index name="patient_portal_accounts_legacy_user_idx" unique="false">
            <column ascending="true" name="legacy_user_id"/>
         </index>
         <index name="patient_portal_accounts_login_hash_unique" unique="true">
            <column ascending="true" name="login_identifier_hash"/>
         </index>
         <checkConstraint constraint="((status = ANY (ARRAY['active'::text, 'disabled'::text])))" name="patient_portal_accounts_status_check"/>
      </table>
      <table name="patient_portal_provider_links" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="account_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="patient_portal_provider_links_account_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="patient_portal_accounts"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="legacy_provider_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="provider_name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="provider_url_suffix" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="5" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="last_verified_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="patient_portal_provider_links_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="patient_portal_provider_links_account_active_idx" unique="false">
            <column ascending="true" name="account_id"/>
            <column ascending="true" name="is_active"/>
         </index>
         <index name="patient_portal_provider_links_account_id_legacy_provider_id_key" unique="true">
            <column ascending="true" name="account_id"/>
            <column ascending="true" name="legacy_provider_id"/>
         </index>
         <index name="patient_portal_provider_links_provider_idx" unique="false">
            <column ascending="true" name="legacy_provider_id"/>
            <column ascending="true" name="is_active"/>
         </index>
      </table>
      <table name="payment_gateway_configs" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="payment_gateway_config_id" foreignKey="native_payment_transactions_payment_gateway_config_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="gateway" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'sandbox'::text" digits="0" id="4" name="gateway_environment" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'active'::text" digits="0" id="5" name="status" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="display_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="public_key" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="private_api_key_secret_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="processor_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="api_base_url" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="11" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="13" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="payment_gateway_configs_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="payment_gateway_configs_active_lookup_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="location_id"/>
            <column ascending="true" name="gateway"/>
            <column ascending="true" name="status"/>
         </index>
         <index name="payment_gateway_configs_global_unique" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="gateway"/>
            <column ascending="true" name="gateway_environment"/>
         </index>
         <index name="payment_gateway_configs_location_unique" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="location_id"/>
            <column ascending="true" name="gateway"/>
            <column ascending="true" name="gateway_environment"/>
         </index>
         <checkConstraint constraint="((gateway = 'fluidpay'::text))" name="payment_gateway_configs_gateway_check"/>
         <checkConstraint constraint="((gateway_environment = ANY (ARRAY['sandbox'::text, 'production'::text])))" name="payment_gateway_configs_gateway_environment_check"/>
         <checkConstraint constraint="((practice_id &lt;&gt; ''::text))" name="payment_gateway_configs_practice_id_check"/>
         <checkConstraint constraint="(((public_key IS NULL) OR (public_key ~~ 'pub_%'::text)))" name="payment_gateway_configs_public_key_check"/>
         <checkConstraint constraint="((status = ANY (ARRAY['active'::text, 'inactive'::text])))" name="payment_gateway_configs_status_check"/>
      </table>
      <table name="promotion_applications" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="promotion_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="promotion_applications_promotion_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="promotion_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="patient_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="location_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="source_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="source_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="source_invoice_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="source_checkout_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="line_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="catalog_item_kind" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="catalog_item_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="12" name="catalog_item_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="13" name="discount_cents" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="14" name="quote_context_hash" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="15" name="promotion_snapshot" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="16" name="cart_context" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="17" name="actor_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="18" name="idempotency_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="19" name="applied_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="20" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="promotion_applications_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="promotion_applications_idempotency_key_key" unique="true">
            <column ascending="true" name="idempotency_key"/>
         </index>
         <index name="promotion_applications_invoice_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="source_invoice_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <index name="promotion_applications_patient_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="patient_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <index name="promotion_applications_practice_source_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="source_kind"/>
            <column ascending="true" name="source_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <checkConstraint constraint="(((catalog_item_kind IS NULL) OR (catalog_item_kind = ANY (ARRAY['product'::text, 'service'::text]))))" name="promotion_applications_catalog_item_kind_check"/>
         <checkConstraint constraint="((discount_cents &gt; 0))" name="promotion_applications_discount_cents_check"/>
         <checkConstraint constraint="((source_kind = ANY (ARRAY['checkout'::text, 'invoice'::text, 'payment'::text, 'manual'::text, 'system'::text])))" name="promotion_applications_source_kind_check"/>
      </table>
      <table name="promotion_definitions" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="promotion_definition_id" foreignKey="promotion_applications_promotion_definition_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="promotion_definition_id" foreignKey="promotion_linked_items_promotion_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="promotion_linked_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="discount_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="4" id="5" name="discount_percent" nullable="true" remarks="" size="7" type="numeric" typeCode="2"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="discount_amount_cents" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'USD'::bpchar" digits="0" id="7" name="currency_code" nullable="false" remarks="" size="3" type="bpchar" typeCode="1"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="8" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="9" name="starts_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="10" name="ends_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="11" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="promotion_definitions_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="promotion_definitions_practice_active_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="is_active"/>
            <column ascending="true" name="starts_at"/>
            <column ascending="true" name="ends_at"/>
         </index>
         <index name="promotion_definitions_practice_name_unique" unique="true">
            <column ascending="true" name="practice_id"/>
         </index>
         <checkConstraint constraint="(((ends_at IS NULL) OR (starts_at IS NULL) OR (ends_at &gt; starts_at)))" name="promotion_definitions_check"/>
         <checkConstraint constraint="((((discount_type = 'percent'::text) AND (discount_percent IS NOT NULL) AND (discount_amount_cents IS NULL)) OR ((discount_type = 'fixed_amount'::text) AND (discount_amount_cents IS NOT NULL) AND (discount_percent IS NULL))))" name="promotion_definitions_check1"/>
         <checkConstraint constraint="((currency_code ~ '^[A-Z]{3}$'::text))" name="promotion_definitions_currency_code_check"/>
         <checkConstraint constraint="(((discount_amount_cents IS NULL) OR (discount_amount_cents &gt; 0)))" name="promotion_definitions_discount_amount_cents_check"/>
         <checkConstraint constraint="(((discount_percent IS NULL) OR ((discount_percent &gt; (0)::numeric) AND (discount_percent &lt;= (100)::numeric))))" name="promotion_definitions_discount_percent_check"/>
         <checkConstraint constraint="((discount_type = ANY (ARRAY['percent'::text, 'fixed_amount'::text])))" name="promotion_definitions_discount_type_check"/>
         <checkConstraint constraint="((name &lt;&gt; ''::text))" name="promotion_definitions_name_check"/>
      </table>
      <table name="promotion_linked_items" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="promotion_definition_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="promotion_linked_items_promotion_definition_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="promotion_definitions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="catalog_item_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="catalog_item_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="catalog_item_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="promotion_linked_items_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="promotion_linked_items_definition_idx" unique="false">
            <column ascending="true" name="promotion_definition_id"/>
         </index>
         <index name="promotion_linked_items_lookup_idx" unique="false">
            <column ascending="true" name="catalog_item_kind"/>
            <column ascending="true" name="catalog_item_id"/>
         </index>
         <index name="promotion_linked_items_promotion_definition_id_catalog_item_key" unique="true">
            <column ascending="true" name="promotion_definition_id"/>
            <column ascending="true" name="catalog_item_kind"/>
            <column ascending="true" name="catalog_item_id"/>
         </index>
         <checkConstraint constraint="((catalog_item_kind = ANY (ARRAY['product'::text, 'service'::text])))" name="promotion_linked_items_catalog_item_kind_check"/>
      </table>
      <table name="rbac_audit_events" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="actor_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="actor_user_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="action" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="target_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="target_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="7" name="metadata" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="rbac_audit_events_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="rbac_audit_events_practice_created_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="false" name="created_at"/>
         </index>
         <index name="rbac_audit_events_target_idx" unique="false">
            <column ascending="true" name="target_type"/>
            <column ascending="true" name="target_id"/>
         </index>
         <checkConstraint constraint="((action &lt;&gt; ''::text))" name="rbac_audit_events_action_check"/>
         <checkConstraint constraint="((target_type &lt;&gt; ''::text))" name="rbac_audit_events_target_type_check"/>
      </table>
      <table name="rbac_feature_catalog" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="feature_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <child column="feature_key" foreignKey="rbac_role_permissions_feature_key_fkey" implied="false" onDeleteCascade="false" schema="public" table="rbac_role_permissions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="module_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="actions" nullable="false" remarks="" size="2147483647" type="_text" typeCode="2003"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="5" name="sort_order" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="6" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="feature_key" sequenceNumberInPK="1"/>
         <index name="rbac_feature_catalog_pkey" unique="true">
            <column ascending="true" name="feature_key"/>
         </index>
         <checkConstraint constraint="((array_length(actions, 1) &gt; 0))" name="rbac_feature_catalog_actions_check"/>
         <checkConstraint constraint="((actions &lt;@ ARRAY['view'::text, 'create'::text, 'edit'::text, 'delete'::text, 'export'::text, 'manage'::text, 'assign'::text, 'refund'::text]))" name="rbac_feature_catalog_actions_check1"/>
         <checkConstraint constraint="((feature_key &lt;&gt; ''::text))" name="rbac_feature_catalog_feature_key_check"/>
         <checkConstraint constraint="((module_key &lt;&gt; ''::text))" name="rbac_feature_catalog_module_key_check"/>
         <checkConstraint constraint="((name &lt;&gt; ''::text))" name="rbac_feature_catalog_name_check"/>
      </table>
      <table name="rbac_role_emulation_grants" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="role_id" nullable="true" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="rbac_role_emulation_grants_role_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_roles"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="token_hash" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="granted_by_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="granted_by_user_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="7" name="expires_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="'role'::text" digits="0" id="8" name="emulation_kind" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="rbac_role_emulation_grants_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="rbac_role_emulation_grants_practice_expiry_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="rbac_role_emulation_grants_practice_token_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="token_hash"/>
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="rbac_role_emulation_grants_role_idx" unique="false">
            <column ascending="true" name="role_id"/>
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="rbac_role_emulation_grants_token_hash_key" unique="true">
            <column ascending="true" name="token_hash"/>
         </index>
         <checkConstraint constraint="((expires_at &gt; created_at))" name="rbac_role_emulation_grants_check"/>
         <checkConstraint constraint="((((emulation_kind = 'role'::text) AND (role_id IS NOT NULL)) OR ((emulation_kind = 'super_admin'::text) AND (role_id IS NULL))))" name="rbac_role_emulation_grants_kind_check"/>
         <checkConstraint constraint="((token_hash &lt;&gt; ''::text))" name="rbac_role_emulation_grants_token_hash_check"/>
      </table>
      <table name="rbac_role_permissions" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="role_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="rbac_role_permissions_role_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_roles"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="feature_key" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="feature_key" foreignKey="rbac_role_permissions_feature_key_fkey" implied="false" onDeleteCascade="false" schema="public" table="rbac_feature_catalog"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="action" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="3" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="role_id" sequenceNumberInPK="1"/>
         <primaryKey column="feature_key" sequenceNumberInPK="2"/>
         <primaryKey column="action" sequenceNumberInPK="3"/>
         <index name="rbac_role_permissions_pkey" unique="true">
            <column ascending="true" name="role_id"/>
            <column ascending="true" name="feature_key"/>
            <column ascending="true" name="action"/>
         </index>
         <index name="rbac_role_permissions_feature_idx" unique="false">
            <column ascending="true" name="feature_key"/>
            <column ascending="true" name="action"/>
         </index>
         <checkConstraint constraint="((action = ANY (ARRAY['view'::text, 'create'::text, 'edit'::text, 'delete'::text, 'export'::text, 'manage'::text, 'assign'::text, 'refund'::text])))" name="rbac_role_permissions_action_check"/>
      </table>
      <table name="rbac_roles" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="role_id" foreignKey="rbac_role_emulation_grants_role_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_role_emulation_grants"/>
            <child column="role_id" foreignKey="rbac_role_permissions_role_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_role_permissions"/>
            <child column="role_id" foreignKey="rbac_user_roles_role_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_user_roles"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="normalized_name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="5" name="is_system" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="6" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="rbac_roles_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="rbac_roles_practice_active_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="is_active"/>
            <column ascending="true" name="normalized_name"/>
         </index>
         <index name="rbac_roles_practice_id_normalized_name_key" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="normalized_name"/>
         </index>
         <checkConstraint constraint="((name &lt;&gt; ''::text))" name="rbac_roles_name_check"/>
         <checkConstraint constraint="((normalized_name &lt;&gt; ''::text))" name="rbac_roles_normalized_name_check"/>
         <checkConstraint constraint="((normalized_name &lt;&gt; 'master'::text))" name="rbac_roles_normalized_name_check1"/>
      </table>
      <table name="rbac_user_locations" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="user_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="rbac_user_locations_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_location_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="2" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="3" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="user_id" sequenceNumberInPK="1"/>
         <primaryKey column="practice_location_id" sequenceNumberInPK="2"/>
         <index name="rbac_user_locations_pkey" unique="true">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="practice_location_id"/>
         </index>
         <index name="rbac_user_locations_active_idx" unique="false">
            <column ascending="true" name="practice_location_id"/>
            <column ascending="true" name="is_active"/>
         </index>
         <checkConstraint constraint="((practice_location_id &lt;&gt; ''::text))" name="rbac_user_locations_practice_location_id_check"/>
      </table>
      <table name="rbac_user_roles" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="user_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="rbac_user_roles_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="role_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="rbac_user_roles_role_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_roles"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="2" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="user_id" sequenceNumberInPK="1"/>
         <primaryKey column="role_id" sequenceNumberInPK="2"/>
         <index name="rbac_user_roles_pkey" unique="true">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="role_id"/>
         </index>
         <index name="rbac_user_roles_role_idx" unique="false">
            <column ascending="true" name="role_id"/>
         </index>
      </table>
      <table name="rbac_users" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="user_id" foreignKey="rbac_user_locations_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_user_locations"/>
            <child column="user_id" foreignKey="rbac_user_roles_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="rbac_user_roles"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="practice_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="legacy_user_id" nullable="true" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="schema_migrations"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="user_name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="normalized_user_name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="user_type" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="first_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="last_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="email" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="phone" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="10" name="is_active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="11" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="rbac_users_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="rbac_users_legacy_user_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="legacy_user_id"/>
         </index>
         <index name="rbac_users_practice_active_idx" unique="false">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="is_active"/>
            <column ascending="true" name="normalized_user_name"/>
         </index>
         <index name="rbac_users_practice_id_normalized_user_name_key" unique="true">
            <column ascending="true" name="practice_id"/>
            <column ascending="true" name="normalized_user_name"/>
         </index>
         <checkConstraint constraint="((normalized_user_name &lt;&gt; ''::text))" name="rbac_users_normalized_user_name_check"/>
         <checkConstraint constraint="((user_name &lt;&gt; ''::text))" name="rbac_users_user_name_check"/>
      </table>
      <table name="schema_migrations" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <child column="legacy_practice_location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_location_pricing"/>
            <child column="practice_location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_location_pricing"/>
            <child column="legacy_item_lot_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_lots"/>
            <child column="practice_location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_lots"/>
            <child column="legacy_provider_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_provider_mappings"/>
            <child column="practice_location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_provider_mappings"/>
            <child column="provider_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_item_provider_mappings"/>
            <child column="legacy_fee_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_items"/>
            <child column="legacy_item_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_items"/>
            <child column="legacy_practice_service_type_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_items"/>
            <child column="legacy_service_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_items"/>
            <child column="manufacturer_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_items"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="catalog_items"/>
            <child column="practice_location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_card_definition_locations"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_card_definitions"/>
            <child column="actor_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_card_ledger_entries"/>
            <child column="source_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_card_ledger_entries"/>
            <child column="location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_cards"/>
            <child column="patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_cards"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="gift_cards"/>
            <child column="actor_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="loyalty_point_adjustments"/>
            <child column="source_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="loyalty_point_adjustments"/>
            <child column="patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="loyalty_profiles"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="loyalty_profiles"/>
            <child column="checkout_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="gateway_transaction_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="invoice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="processor_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="native_payment_transactions"/>
            <child column="user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="notification_user_states"/>
            <child column="location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="notifications"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="notifications"/>
            <child column="source_entity_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="notifications"/>
            <child column="practice_location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="package_definition_location_prices"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="package_definitions"/>
            <child column="catalog_item_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="package_items"/>
            <child column="actor_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="package_ledger_entries"/>
            <child column="source_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="package_ledger_entries"/>
            <child column="created_by_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_files"/>
            <child column="deleted_by_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_files"/>
            <child column="patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_files"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_files"/>
            <child column="location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
            <child column="patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
            <child column="source_checkout_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
            <child column="source_invoice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
            <child column="source_payment_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_instances"/>
            <child column="catalog_item_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_package_item_balances"/>
            <child column="legacy_patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_portal_accounts"/>
            <child column="legacy_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_portal_accounts"/>
            <child column="legacy_provider_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="patient_portal_provider_links"/>
            <child column="location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="payment_gateway_configs"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="payment_gateway_configs"/>
            <child column="private_api_key_secret_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="payment_gateway_configs"/>
            <child column="processor_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="payment_gateway_configs"/>
            <child column="actor_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="catalog_item_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="line_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="location_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="patient_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="source_checkout_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="source_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="source_invoice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_applications"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_definitions"/>
            <child column="catalog_item_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="promotion_linked_items"/>
            <child column="actor_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_audit_events"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_audit_events"/>
            <child column="target_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_audit_events"/>
            <child column="granted_by_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_role_emulation_grants"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_role_emulation_grants"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_roles"/>
            <child column="legacy_user_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_users"/>
            <child column="practice_id" foreignKey="Implied Constraint" implied="true" onDeleteCascade="false" schema="public" table="rbac_users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="2" name="applied_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="schema_migrations_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
   </tables>
   <routines>
      <routine dataAccess="MODIFIES" deterministic="true" name="armor(bytea)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="armor(bytea, text[], text[])" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text[]"/>
            <parameter mode="IN" type="text[]"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="crypt(text, text)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="dearmor(text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="decrypt(bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="decrypt_iv(bytea, bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="digest(bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="digest(text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="encrypt(bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="encrypt_iv(bytea, bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="gen_random_bytes(integer)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="integer"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="gen_random_uuid()" returnType="uuid" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="gen_salt(text)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="gen_salt(text, integer)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="integer"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="hmac(bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="hmac(text, text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_armor_headers(text, OUT key text, OUT value text)" returnType="SETOF record" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="OUT" name="key" type="text"/>
            <parameter mode="OUT" name="value" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_key_id(bytea)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_pub_decrypt(bytea, bytea)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_pub_decrypt(bytea, bytea, text)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_pub_decrypt(bytea, bytea, text, text)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_pub_decrypt_bytea(bytea, bytea)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_pub_decrypt_bytea(bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_pub_decrypt_bytea(bytea, bytea, text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_pub_encrypt(text, bytea)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="bytea"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_pub_encrypt(text, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_pub_encrypt_bytea(bytea, bytea)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_pub_encrypt_bytea(bytea, bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_sym_decrypt(bytea, text)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_sym_decrypt(bytea, text, text)" returnType="text" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_sym_decrypt_bytea(bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="true" name="pgp_sym_decrypt_bytea(bytea, text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_sym_encrypt(text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_sym_encrypt(text, text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_sym_encrypt_bytea(bytea, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="pgp_sym_encrypt_bytea(bytea, text, text)" returnType="bytea" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="c"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN" type="bytea"/>
            <parameter mode="IN" type="text"/>
            <parameter mode="IN" type="text"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="prevent_gift_card_ledger_mutation()" returnType="trigger" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="plpgsql"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="prevent_package_ledger_mutation()" returnType="trigger" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="plpgsql"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="prevent_promotion_application_mutation()" returnType="trigger" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="plpgsql"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="set_updated_at()" returnType="trigger" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="plpgsql"><![CDATA[Redacted, use --include-routine-definition]]></definition>
         <parameters>
            <parameter mode="IN"/>
         </parameters>
      </routine>
   </routines>
</database>
