Skip to content

Add spec to ensure sharding key is not nullable

Dylan Griffith requested to merge sharding-key-not-null-validation into master

What does this MR do and why?

As part of our Organization Isolation work we are ensuring that all tables have a valid "sharding key". This key will ultimately be used to efficiently identify which organization a row belongs to.

In !136682 (merged) we added a spec to ensure that all newly created tables have a sharding key. Now we want to validate that these sharding keys are also not nullable.

Our spec needs to handle the following ways that we ensure columns are not nullable:

  1. Column is not nullable in the schema like namespace_id NOT NULL
  2. Column is validated using a check constraint like CONSTRAINT check_77fea3f0e7 CHECK ((namespace_id IS NOT NULL))

This also adds a few more sharding keys to tables that are using a check constraint rather than a NOT NULL column. This is to illustrate that the spec does indeed handle both cases.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading