Create a Java entity to store ThreatMatch objects in SQL (#617)

* Squash everything together
Create SafeBrowsing_Threats table

Create LocalDateConverter and add indexes to SafeBrowsingThreats

Add indexes to SafeBrowsingThreats and make small style changes

Pass in DateTimeFormatter

Delete LocalDateConverterTest.java

Rebase

Make changes to ThreatType comments

Create LocalDateConverterTest

Add review changes

Add SafeBrowsingThreatTest

Rename repoId, refactor LocalDateConverterTest/SafeBrowsingThreatTest, add foreign keys

Change imports

Add foreign keys and rename version number

Add new generated db-schema file

Clean up null test cases

Add changes

Add foreign keys into SafeBrowsingThreatTeat and apply style checks

Add SafeBrowsingThreatTest into SqlIntegrationTestSuite and change golden file

Make small changes to SafeBrowsingThreatTest

Add tests for ForeignKeyViolations and remove setId in SafeBrowsingThreat

* Change V35 -> V36

* Add a foreign key test for a reference to Registrar

* Move some variables around
This commit is contained in:
Legina Chen 2020-06-22 12:07:59 -07:00 committed by GitHub
parent 3ac5f06991
commit f28b0d86dc
10 changed files with 588 additions and 2 deletions

View file

@ -407,6 +407,17 @@ create sequence history_id_sequence start 1 increment 1;
should_publish boolean not null,
primary key (revision_id)
);
create table "SafeBrowsingThreat" (
id bigserial not null,
check_date text not null,
domain_name text not null,
domain_repo_id text not null,
registrar_id text not null,
threat_type text not null,
tld text not null,
primary key (id)
);
create index IDXih4b2tea127p5rb61gje6e1y2 on "BillingCancellation" (registrar_id);
create index IDX2exdfbx6oiiwnhr8j6gjpqt2j on "BillingCancellation" (event_time);
create index IDXqa3g92jc17e8dtiaviy4fet4x on "BillingCancellation" (billing_time);
@ -448,6 +459,9 @@ create index idx_registry_lock_registrar_id on "RegistryLock" (registrar_id);
alter table if exists "RegistryLock"
add constraint idx_registry_lock_repo_id_revision_id unique (repo_id, revision_id);
create index reservedlist_name_idx on "ReservedList" (name);
create index safebrowsing_threat_registrar_id_idx on "SafeBrowsingThreat" (registrar_id);
create index safebrowsing_threat_tld_idx on "SafeBrowsingThreat" (tld);
create index safebrowsing_threat_check_date_idx on "SafeBrowsingThreat" (check_date);
alter table if exists "ClaimsEntry"
add constraint FK6sc6at5hedffc0nhdcab6ivuq