Remove TylerEnv from CodeDatabase#408
Conversation
Co-authored-by: Copilot <copilot@github.com>
|
|
||
| log.info("Checking table if absent"); | ||
| try (CodeDatabase cd = new CodeDatabase(tylerDomain, codeDs.getConnection())) { | ||
| try (CodeDatabase cd = new CodeDatabase(tylerDomain.jurisdiction(), codeDs.getConnection())) { |
There was a problem hiding this comment.
Might be slightly more than the original issue, but it looks like TylerEnv isn't really used anymore in this class (is included in the logs and the getName(), which is just being used for scheduling stuff), so we should probably replace the TylerDomain object with a Jurisdiction object here as well.
| public void update10To11() throws SQLException { | ||
| // The codes database doesn't need to know about Tyler's environment | ||
| final String stripEnvSuffix = | ||
| "UPDATE %s SET domain = regexp_replace(domain, '-(stage|prod)$', '')"; |
There was a problem hiding this comment.
IMO, I think it also makes sense to rename the domain column to jurisdiction after the regex as well.
BryceStevenWilley
left a comment
There was a problem hiding this comment.
Can confirm that the change works well, but there are still some leftover names / references to domain that are no longer the domain but the jurisdiction that should be changed.
| /** The jurisdiction (e.g illinois) that this database is working over */ | ||
| public abstract Jurisdiction getDomain(); |
There was a problem hiding this comment.
Should rename this getJurisdiction()
| private String domainStr() { | ||
| return tylerDomain.getName(); | ||
| return jurisdiction.getName(); | ||
| } |
There was a problem hiding this comment.
Should rename this to jurisStr().
The code database was tagging every row with 'illinois-stage' instead of just 'illinois' because
CodeDatabasewas accepting aTylerDomain, which combined the jurisdiction and the env together. The env does not belong here, as one database should only ever serve one jurisdiction.To fix this, I changed
CodeDatabaseandCodeDatabaseAPIto accept the Jurisdiction directly., and wrote a migration (which strips '-stage' and '-prod') to clean up existing rows, and updated all callers to follow the same pattern used in recent refactors.Resolves #400