Skip to content

Database Naming Quick Reference

Use this page as the short lookup version of the fuller Database Naming and DDL Patterns chapter.

Core rules

AreaPreferred patternExample
General object nameslowercase snake_caseplatform_users
Platform-owned tablesplatform_<meaning>platform_users
Document head tablesdoc_<domain>_<type>doc_trd_sales_invoice
Document part tablesdoc_<domain>_<type>__<part>doc_trd_sales_invoice__lines
Catalog tablescat_<domain>_<type>cat_trd_customer
Operational registersor_<domain>_<register>or_trd_inventory
Reference registersrr_<domain>_<register>rr_trd_pricing
Viewsv_<meaning> or <module>_<meaning>_vv_open_receivables
Materialized viewsmv_<meaning>mv_monthly_balances
Functionsfn_<meaning>fn_close_month
Proceduressp_<meaning> if that convention is used locallysp_rebuild_balances

Constraint and index patterns

ObjectPreferred patternExample
Foreign keyfk_<table>__<referenced_table>fk_pm_receivable_payment__pm_party
Unique constraint/indexuq_<table>__<business_key>uq_trd_item_price__item_price_type_currency_effective_from
Non-unique indexix_<table>__<important_columns>ix_accounting_entries__entity_id_posting_date
Check constraintck_<table>__<rule>ck_document_number_sequences__last_seq_positive
Triggertrg_<table>__<purpose>trg_document_relationships__mirror_reverse_edge

Migration file names

KindPreferred patternExample
Versioned migrationVyyyy_mm_dd_nnnn__description.sqlV2026_04_18_0001__add_trd_business_partner.sql
Repeatable migrationR__description.sqlR__rebuild_reporting_helpers.sql

Practical rules

  • Prefer business meaning over UI labels or temporary implementation names.
  • Keep platform and vertical prefixes explicit so ownership is obvious.
  • Use stable names that will remain readable once SQL files become embedded resource names.
  • When in doubt, prefer consistency with adjacent tables and existing packs over novelty.

Released under the Apache License 2.0.