Skip to content

Add swap_primary_key database helper

Problem

As brought up in !97926 (comment 1107227533), in order to partition a table we need to make sure to include the partitioning key in the following constraints:

  • The primary key
  • All foreign keys referencing the table to be partitioned
  • All unique constraints

Solution

Add a database helper for the following use case:

  • Introduce swap_primary_key database helper

cc @grzesiek @mbobin @alexives @stomlinson @mattkasa

Edited by Max Orefice