[2.1] catalog.judgment #18

Closed
opened 2026-06-13 23:54:22 +02:00 by dernbu · 0 comments
Owner

Parent

#2

Schema

CREATE TABLE catalog.judgment (
  id             bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  decision_year  smallint NOT NULL CHECK (decision_year > 0),
  court_code     text     NOT NULL CHECK (court_code = upper(court_code)),
  decision_number integer NOT NULL CHECK (decision_number > 0),
  citation       text     GENERATED ALWAYS AS (decision_year || ' ' || court_code || ' ' || decision_number) STORED,
  UNIQUE (decision_year, court_code, decision_number)
);

ON DELETE RESTRICT for any FK referencing this table.

Done when

  • Table applies cleanly in Flyway
  • Check & unique constraints reject invalid data
  • Generated citation column renders correctly
## Parent #2 ## Schema ```sql CREATE TABLE catalog.judgment ( id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, decision_year smallint NOT NULL CHECK (decision_year > 0), court_code text NOT NULL CHECK (court_code = upper(court_code)), decision_number integer NOT NULL CHECK (decision_number > 0), citation text GENERATED ALWAYS AS (decision_year || ' ' || court_code || ' ' || decision_number) STORED, UNIQUE (decision_year, court_code, decision_number) ); ``` `ON DELETE RESTRICT` for any FK referencing this table. ## Done when - Table applies cleanly in Flyway - Check & unique constraints reject invalid data - Generated `citation` column renders correctly
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dernbu/lawnet-scraper#18
No description provided.