-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: validation schema updates (#241)
* feat: validation schema updates * fix: circular dependency * fix: update liquibase/changes/feat_240.sql Co-authored-by: David Gamez <[email protected]> * fix: update liquibase/changes/feat_240.sql Co-authored-by: David Gamez <[email protected]> --------- Co-authored-by: David Gamez <[email protected]>
- Loading branch information
1 parent
afd376f
commit f8c14ff
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- 1. Add Table ValidationReport | ||
CREATE TABLE ValidationReport ( | ||
id VARCHAR(255) PRIMARY KEY, | ||
validator_version VARCHAR(255) | ||
); | ||
|
||
-- 2. Adding a table linking GTFSDataset to the validation report to avoid circular dependency warning from sqlacodegen | ||
CREATE TABLE ValidationReportGTFSDataset ( | ||
dataset_id VARCHAR(255) REFERENCES GTFSDataset(id), | ||
validation_report_id VARCHAR(255) REFERENCES ValidationReport UNIQUE, | ||
PRIMARY KEY (validation_report_id, dataset_id) | ||
); | ||
|
||
-- 3. Create custom type for severity | ||
CREATE TYPE severity_type AS ENUM ('ERROR', 'WARNING', 'INFO'); | ||
|
||
-- 4. Add Table Notice | ||
CREATE TABLE Notice ( | ||
dataset_id VARCHAR(255) REFERENCES GTFSDataset(id), | ||
validation_report_id VARCHAR(255) REFERENCES ValidationReport(id), | ||
notice_code VARCHAR(255), | ||
severity severity_type, | ||
total_notices INT NOT NULL CHECK (total_notices > 0), | ||
PRIMARY KEY (dataset_id, validation_report_id, notice_code) | ||
); | ||
|
||
-- 5. Add indexes for the Notice table | ||
CREATE INDEX idx_notice_dataset_id ON Notice(dataset_id); | ||
CREATE INDEX idx_notice_dataset_id_validation_id ON Notice(dataset_id, validation_report_id); |