Skip to content

Remove TylerEnv from CodeDatabase#408

Open
rajeswari1301 wants to merge 3 commits into
mainfrom
codes-db-cleanup
Open

Remove TylerEnv from CodeDatabase#408
rajeswari1301 wants to merge 3 commits into
mainfrom
codes-db-cleanup

Conversation

@rajeswari1301

@rajeswari1301 rajeswari1301 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The code database was tagging every row with 'illinois-stage' instead of just 'illinois' because CodeDatabase was accepting a TylerDomain, 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 CodeDatabase and CodeDatabaseAPI to 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


log.info("Checking table if absent");
try (CodeDatabase cd = new CodeDatabase(tylerDomain, codeDs.getConnection())) {
try (CodeDatabase cd = new CodeDatabase(tylerDomain.jurisdiction(), codeDs.getConnection())) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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)$', '')";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IMO, I think it also makes sense to rename the domain column to jurisdiction after the regex as well.

@BryceStevenWilley BryceStevenWilley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment on lines +36 to +37
/** The jurisdiction (e.g illinois) that this database is working over */
public abstract Jurisdiction getDomain();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should rename this getJurisdiction()

Comment on lines 87 to 89
private String domainStr() {
return tylerDomain.getName();
return jurisdiction.getName();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should rename this to jurisStr().

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove TylerEnv from the CodesDatabase

2 participants