Skip to content

Allow configuring a desired_sharding_key in db/docs

As documented in #429162 (closed) all tables must have a sharding key. Before we take the step to backfill all the sharding keys we can introduce a lightweight way to declare the desired sharding key for a table in the db/docs. The syntax would look like:

desired_sharding_key:
  column: project_id
  backfill_via: SELECT project_id FROM issues WHERE id = :issue_id

The details of backfill_via can be figured out later but the key here is to have enough information to automatically generate batched background migrations that will backfill the project_id column from some related table.

Edited by Dylan Griffith