A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.gitlab.com/development/database/constraint_naming_convention/ below:

Constraints naming conventions | GitLab Docs

Help us learn about your current experience with the documentation.

Take the survey

.

Constraints naming conventions

The most common option is to let Rails pick the name for database constraints and indexes or let PostgreSQL use the defaults (when applicable). However, when defining custom names in Rails, or working in Go applications where no ORM is used, it is important to follow strict naming conventions to improve consistency and discoverability.

The table below describes the naming conventions for custom PostgreSQL constraints. The intent is not to retroactively change names in existing databases but rather ensure consistency of future changes.

Type Syntax Notes Examples Primary Key pk_<table name> pk_projects Foreign Key fk_<table name>_<column name>[_and_<column name>]*_<foreign table name> fk_projects_group_id_groups Index index_<table name>_on_<column name>[_and_<column name>]*[_and_<column name in partial clause>]* Index names must be all lowercase. index_repositories_on_group_id Unique Constraint unique_<table name>_<column name>[_and_<column name>]* unique_projects_group_id_and_name Check Constraint check_<table name>_<column name>[_and_<column name>]*[_<suffix>]? The optional suffix should denote the type of validation, such as length and enum. It can also be used to disambiguate multiple CHECK constraints on the same column. check_projects_name_length
check_projects_type_enum
check_projects_admin1_id_and_admin2_id_differ Exclusion Constraint excl_<table name>_<column name>[_and_<column name>]*_[_<suffix>]? The optional suffix should denote the type of exclusion being performed. excl_reservations_start_at_end_at_no_overlap Observations

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4