Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Add a test which ensures that new tables get PRIMARY KEYs.#16648

Open
reivilibre wants to merge 2 commits into
developfrom
rei/psql_lint_ensure_pkey
Open

Add a test which ensures that new tables get PRIMARY KEYs.#16648
reivilibre wants to merge 2 commits into
developfrom
rei/psql_lint_ensure_pkey

Conversation

@reivilibre

@reivilibre reivilibre commented Nov 16, 2023

Copy link
Copy Markdown
Contributor

We have a history, even recently, of not using PRIMARY KEYs and many of the cases seem tragically just because someone was unaware that it is good practice / maybe cribbed off earlier schema deltas. In many cases a UNIQUE index was created instead when that could've been a PRIMARY KEY.

This PR adds a test that flags up missing PRIMARY KEYs.

Base: develop

Original commit schedule, with full messages:

  1. Add a PRIMARY KEY lint

Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
@reivilibre reivilibre requested a review from a team as a code owner November 16, 2023 12:23

@erikjohnston erikjohnston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not enforce that the table either has a primary key or a replica identity?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants