.ai/principles/distilled/cells-fundamentals.md
gitlab_main_org for all tables in the main: database that belong to an organization (for example, projects and groups).gitlab_main_cell_setting for cell-setting tables in the main: database (for example, application_settings); ensure these tables are not referenced by foreign keys from organization tables.gitlab_main_cell_local for tables in the main: database that are distinct per cell (for example, zoekt_nodes, shards); ensure these tables are not referenced by foreign keys from organization tables.gitlab_ci for all tables in the ci: database that belong to an organization (for example, ci_pipelines, ci_builds).gitlab_ci_cell_local for tables in the ci: database that are distinct per cell (for example, instance_type_ci_runners, ci_cost_settings); ensure these tables are not referenced by foreign keys from organization tables.gitlab_main_user only for user functionality that is not organizational level; prefer gitlab_main_org for most user functionality (for example, commenting on an issue).gitlab_shared_org for tables with data across multiple databases that have organization_id for sharding; DO NOT use auto-incrementing integer primary keys — use composite or UUID primary keys instead.gitlab_shared_cell_local for cell-local shared tables that do not require sharding and exist across multiple databases (for example, loose_foreign_keys_deleted_records).gitlab_main schema — use gitlab_main_org instead.require_sharding_key: true so that all tables assigned to the schema must define a sharding key.sharding_root_tables (for example, projects, namespaces, organizations) in the schema YAML under db/gitlab_schemas/.id columns — uniqueness is enforced across all cells automatically.UNIQUE constraints for global uniqueness across cells — scope uniqueness indexes to include the sharding_key column instead.ActiveRecord::FixedItemsModel::Model instead of a database table; use belongs_to_fixed_items for associations with fixed-item models.For the full picture, see: