mirror of
https://github.com/google/nomulus.git
synced 2025-05-23 04:39:35 +02:00
* 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
489 lines
18 KiB
Text
489 lines
18 KiB
Text
-- Copyright 2019 The Nomulus Authors. All Rights Reserved.
|
|
--
|
|
-- Licensed under the Apache License, Version 2.0 (the "License");
|
|
-- you may not use this file except in compliance with the License.
|
|
-- You may obtain a copy of the License at
|
|
--
|
|
-- http://www.apache.org/licenses/LICENSE-2.0
|
|
--
|
|
-- Unless required by applicable law or agreed to in writing, software
|
|
-- distributed under the License is distributed on an "AS IS" BASIS,
|
|
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
-- See the License for the specific language governing permissions and
|
|
-- limitations under the License.
|
|
create sequence history_id_sequence start 1 increment 1;
|
|
|
|
create table "BillingCancellation" (
|
|
billing_cancellation_id bigserial not null,
|
|
registrar_id text not null,
|
|
domain_history_revision_id int8 not null,
|
|
domain_repo_id text not null,
|
|
event_time timestamptz not null,
|
|
flags text[],
|
|
reason text not null,
|
|
domain_name text not null,
|
|
billing_time timestamptz,
|
|
billing_event_id int8,
|
|
billing_recurrence_id int8,
|
|
primary key (billing_cancellation_id)
|
|
);
|
|
|
|
create table "BillingEvent" (
|
|
billing_event_id bigserial not null,
|
|
registrar_id text not null,
|
|
domain_history_revision_id int8 not null,
|
|
domain_repo_id text not null,
|
|
event_time timestamptz not null,
|
|
flags text[],
|
|
reason text not null,
|
|
domain_name text not null,
|
|
allocation_token_id text,
|
|
billing_time timestamptz,
|
|
cancellation_matching_billing_recurrence_id int8,
|
|
cost_amount numeric(19, 2),
|
|
cost_currency text,
|
|
period_years int4,
|
|
synthetic_creation_time timestamptz,
|
|
primary key (billing_event_id)
|
|
);
|
|
|
|
create table "BillingRecurrence" (
|
|
billing_recurrence_id bigserial not null,
|
|
registrar_id text not null,
|
|
domain_history_revision_id int8 not null,
|
|
domain_repo_id text not null,
|
|
event_time timestamptz not null,
|
|
flags text[],
|
|
reason text not null,
|
|
domain_name text not null,
|
|
recurrence_end_time timestamptz,
|
|
recurrence_time_of_year text,
|
|
primary key (billing_recurrence_id)
|
|
);
|
|
|
|
create table "ClaimsEntry" (
|
|
revision_id int8 not null,
|
|
claim_key text not null,
|
|
domain_label text not null,
|
|
primary key (revision_id, domain_label)
|
|
);
|
|
|
|
create table "ClaimsList" (
|
|
revision_id bigserial not null,
|
|
creation_timestamp timestamptz not null,
|
|
tmdb_generation_time timestamptz not null,
|
|
primary key (revision_id)
|
|
);
|
|
|
|
create table "Contact" (
|
|
repo_id text not null,
|
|
creation_registrar_id text not null,
|
|
creation_time timestamptz not null,
|
|
current_sponsor_registrar_id text not null,
|
|
deletion_time timestamptz,
|
|
last_epp_update_registrar_id text,
|
|
last_epp_update_time timestamptz,
|
|
statuses text[],
|
|
auth_info_repo_id text,
|
|
auth_info_value text,
|
|
contact_id text,
|
|
disclose_types_addr text[],
|
|
disclose_show_email boolean,
|
|
disclose_show_fax boolean,
|
|
disclose_mode_flag boolean,
|
|
disclose_types_name text[],
|
|
disclose_types_org text[],
|
|
disclose_show_voice boolean,
|
|
email text,
|
|
fax_phone_extension text,
|
|
fax_phone_number text,
|
|
addr_i18n_city text,
|
|
addr_i18n_country_code text,
|
|
addr_i18n_state text,
|
|
addr_i18n_street_line1 text,
|
|
addr_i18n_street_line2 text,
|
|
addr_i18n_street_line3 text,
|
|
addr_i18n_zip text,
|
|
addr_i18n_name text,
|
|
addr_i18n_org text,
|
|
addr_i18n_type text,
|
|
last_transfer_time timestamptz,
|
|
addr_local_city text,
|
|
addr_local_country_code text,
|
|
addr_local_state text,
|
|
addr_local_street_line1 text,
|
|
addr_local_street_line2 text,
|
|
addr_local_street_line3 text,
|
|
addr_local_zip text,
|
|
addr_local_name text,
|
|
addr_local_org text,
|
|
addr_local_type text,
|
|
search_name text,
|
|
transfer_gaining_poll_message_id int8,
|
|
transfer_losing_poll_message_id int8,
|
|
transfer_client_txn_id text,
|
|
transfer_server_txn_id text,
|
|
transfer_gaining_registrar_id text,
|
|
transfer_losing_registrar_id text,
|
|
transfer_pending_expiration_time timestamptz,
|
|
transfer_request_time timestamptz,
|
|
transfer_status text,
|
|
voice_phone_extension text,
|
|
voice_phone_number text,
|
|
primary key (repo_id)
|
|
);
|
|
|
|
create table "Cursor" (
|
|
scope text not null,
|
|
type text not null,
|
|
cursor_time timestamptz not null,
|
|
last_update_time timestamptz not null,
|
|
primary key (scope, type)
|
|
);
|
|
|
|
create table "DelegationSignerData" (
|
|
key_tag int4 not null,
|
|
algorithm int4 not null,
|
|
digest bytea,
|
|
digest_type int4 not null,
|
|
primary key (key_tag)
|
|
);
|
|
|
|
create table "Domain" (
|
|
repo_id text not null,
|
|
creation_registrar_id text not null,
|
|
creation_time timestamptz not null,
|
|
current_sponsor_registrar_id text not null,
|
|
deletion_time timestamptz,
|
|
last_epp_update_registrar_id text,
|
|
last_epp_update_time timestamptz,
|
|
statuses text[],
|
|
admin_contact text,
|
|
auth_info_repo_id text,
|
|
auth_info_value text,
|
|
billing_contact text,
|
|
domain_name text,
|
|
idn_table_name text,
|
|
last_transfer_time timestamptz,
|
|
launch_notice_accepted_time timestamptz,
|
|
launch_notice_expiration_time timestamptz,
|
|
launch_notice_tcn_id text,
|
|
launch_notice_validator_id text,
|
|
registrant_contact text,
|
|
registration_expiration_time timestamptz,
|
|
smd_id text,
|
|
subordinate_hosts text[],
|
|
tech_contact text,
|
|
tld text,
|
|
transfer_billing_cancellation_id int8,
|
|
transfer_billing_recurrence_id int8,
|
|
transfer_autorenew_poll_message_id int8,
|
|
transfer_billing_event_id int8,
|
|
transfer_renew_period_unit text,
|
|
transfer_renew_period_value int4,
|
|
transfer_registration_expiration_time timestamptz,
|
|
transfer_gaining_poll_message_id int8,
|
|
transfer_losing_poll_message_id int8,
|
|
transfer_client_txn_id text,
|
|
transfer_server_txn_id text,
|
|
transfer_gaining_registrar_id text,
|
|
transfer_losing_registrar_id text,
|
|
transfer_pending_expiration_time timestamptz,
|
|
transfer_request_time timestamptz,
|
|
transfer_status text,
|
|
primary key (repo_id)
|
|
);
|
|
|
|
create table "DomainHost" (
|
|
domain_repo_id text not null,
|
|
ns_hosts text
|
|
);
|
|
|
|
create table "GracePeriod" (
|
|
id bigserial not null,
|
|
billing_event_one_time bytea,
|
|
billing_event_recurring bytea,
|
|
registrar_id text,
|
|
expiration_time timestamptz,
|
|
type int4,
|
|
primary key (id)
|
|
);
|
|
|
|
create table "HostHistory" (
|
|
history_revision_id int8 not null,
|
|
history_by_superuser boolean not null,
|
|
history_registrar_id text,
|
|
history_modification_time timestamptz not null,
|
|
history_reason text not null,
|
|
history_requested_by_registrar boolean not null,
|
|
history_client_transaction_id text,
|
|
history_server_transaction_id text,
|
|
history_type text not null,
|
|
history_xml_bytes bytea not null,
|
|
host_name text,
|
|
inet_addresses text[],
|
|
last_superordinate_change timestamptz,
|
|
last_transfer_time timestamptz,
|
|
superordinate_domain text,
|
|
creation_registrar_id text not null,
|
|
creation_time timestamptz not null,
|
|
current_sponsor_registrar_id text not null,
|
|
deletion_time timestamptz,
|
|
last_epp_update_registrar_id text,
|
|
last_epp_update_time timestamptz,
|
|
statuses text[],
|
|
host_repo_id text not null,
|
|
primary key (history_revision_id)
|
|
);
|
|
|
|
create table "HostResource" (
|
|
repo_id text not null,
|
|
creation_registrar_id text not null,
|
|
creation_time timestamptz not null,
|
|
current_sponsor_registrar_id text not null,
|
|
deletion_time timestamptz,
|
|
last_epp_update_registrar_id text,
|
|
last_epp_update_time timestamptz,
|
|
statuses text[],
|
|
host_name text,
|
|
inet_addresses text[],
|
|
last_superordinate_change timestamptz,
|
|
last_transfer_time timestamptz,
|
|
superordinate_domain text,
|
|
primary key (repo_id)
|
|
);
|
|
|
|
create table "Lock" (
|
|
resource_name text not null,
|
|
tld text not null,
|
|
acquired_time timestamptz not null,
|
|
expiration_time timestamptz not null,
|
|
request_log_id text not null,
|
|
primary key (resource_name, tld)
|
|
);
|
|
|
|
create table "PollMessage" (
|
|
type text not null,
|
|
poll_message_id bigserial not null,
|
|
registrar_id text not null,
|
|
contact_repo_id text,
|
|
contact_revision_id int8,
|
|
domain_repo_id text,
|
|
domain_revision_id int8,
|
|
event_time timestamptz not null,
|
|
host_repo_id text,
|
|
host_revision_id int8,
|
|
message text,
|
|
transfer_response_contact_id text,
|
|
transfer_response_domain_expiration_time timestamptz,
|
|
transfer_response_domain_name text,
|
|
pending_action_response_action_result boolean,
|
|
pending_action_response_name_or_id text,
|
|
pending_action_response_processed_date timestamptz,
|
|
pending_action_response_client_txn_id text,
|
|
pending_action_response_server_txn_id text,
|
|
transfer_response_gaining_registrar_id text,
|
|
transfer_response_losing_registrar_id text,
|
|
transfer_response_pending_transfer_expiration_time timestamptz,
|
|
transfer_response_transfer_request_time timestamptz,
|
|
transfer_response_transfer_status text,
|
|
autorenew_end_time timestamptz,
|
|
autorenew_domain_name text,
|
|
primary key (poll_message_id)
|
|
);
|
|
|
|
create table "PremiumEntry" (
|
|
revision_id int8 not null,
|
|
domain_label text not null,
|
|
price numeric(19, 2) not null,
|
|
primary key (revision_id, domain_label)
|
|
);
|
|
|
|
create table "PremiumList" (
|
|
revision_id bigserial not null,
|
|
bloom_filter bytea not null,
|
|
creation_timestamp timestamptz not null,
|
|
currency text not null,
|
|
name text not null,
|
|
primary key (revision_id)
|
|
);
|
|
|
|
create table "Registrar" (
|
|
registrar_id text not null,
|
|
allowed_tlds text[],
|
|
billing_account_map hstore,
|
|
billing_identifier int8,
|
|
block_premium_names boolean not null,
|
|
client_certificate text,
|
|
client_certificate_hash text,
|
|
contacts_require_syncing boolean not null,
|
|
creation_time timestamptz,
|
|
drive_folder_id text,
|
|
email_address text,
|
|
failover_client_certificate text,
|
|
failover_client_certificate_hash text,
|
|
fax_number text,
|
|
iana_identifier int8,
|
|
icann_referral_email text,
|
|
i18n_address_city text,
|
|
i18n_address_country_code text,
|
|
i18n_address_state text,
|
|
i18n_address_street_line1 text,
|
|
i18n_address_street_line2 text,
|
|
i18n_address_street_line3 text,
|
|
i18n_address_zip text,
|
|
ip_address_allow_list text[],
|
|
last_certificate_update_time timestamptz,
|
|
last_update_time timestamptz,
|
|
localized_address_city text,
|
|
localized_address_country_code text,
|
|
localized_address_state text,
|
|
localized_address_street_line1 text,
|
|
localized_address_street_line2 text,
|
|
localized_address_street_line3 text,
|
|
localized_address_zip text,
|
|
password_hash text,
|
|
phone_number text,
|
|
phone_passcode text,
|
|
po_number text,
|
|
rdap_base_urls text[],
|
|
registrar_name text not null,
|
|
registry_lock_allowed boolean not null,
|
|
password_salt text,
|
|
state text,
|
|
type text not null,
|
|
url text,
|
|
whois_server text,
|
|
primary key (registrar_id)
|
|
);
|
|
|
|
create table "RegistrarPoc" (
|
|
email_address text not null,
|
|
allowed_to_set_registry_lock_password boolean not null,
|
|
fax_number text,
|
|
gae_user_id text,
|
|
name text,
|
|
phone_number text,
|
|
registry_lock_email_address text,
|
|
registry_lock_password_hash text,
|
|
registry_lock_password_salt text,
|
|
types text[],
|
|
visible_in_domain_whois_as_abuse boolean not null,
|
|
visible_in_whois_as_admin boolean not null,
|
|
visible_in_whois_as_tech boolean not null,
|
|
primary key (email_address)
|
|
);
|
|
|
|
create table "RegistryLock" (
|
|
revision_id bigserial not null,
|
|
domain_name text not null,
|
|
is_superuser boolean not null,
|
|
last_update_timestamp timestamptz,
|
|
lock_completion_timestamp timestamptz,
|
|
lock_request_timestamp timestamptz not null,
|
|
registrar_id text not null,
|
|
registrar_poc_id text,
|
|
relock_duration int8,
|
|
repo_id text not null,
|
|
unlock_completion_timestamp timestamptz,
|
|
unlock_request_timestamp timestamptz,
|
|
verification_code text not null,
|
|
relock_revision_id int8,
|
|
primary key (revision_id)
|
|
);
|
|
|
|
create table "ReservedEntry" (
|
|
revision_id int8 not null,
|
|
comment text,
|
|
reservation_type int4 not null,
|
|
domain_label text not null,
|
|
primary key (revision_id, domain_label)
|
|
);
|
|
|
|
create table "ReservedList" (
|
|
revision_id bigserial not null,
|
|
creation_timestamp timestamptz not null,
|
|
name text not null,
|
|
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);
|
|
create index IDXqspv57gj2led8ly42fq01t7m7 on "BillingEvent" (registrar_id);
|
|
create index IDX5yfbr88439pxw0v3j86c74fp8 on "BillingEvent" (event_time);
|
|
create index IDX6py6ocrab0ivr76srcd2okpnq on "BillingEvent" (billing_time);
|
|
create index IDXplxf9v56p0wg8ws6qsvd082hk on "BillingEvent" (synthetic_creation_time);
|
|
create index IDXhmv411mdqo5ibn4vy7ykxpmlv on "BillingEvent" (allocation_token_id);
|
|
create index IDXd3gxhkh0jk694pjvh9pyn7wjc on "BillingRecurrence" (registrar_id);
|
|
create index IDX6syykou4nkc7hqa5p8r92cpch on "BillingRecurrence" (event_time);
|
|
create index IDXp3usbtvk0v1m14i5tdp4xnxgc on "BillingRecurrence" (recurrence_end_time);
|
|
create index IDXjny8wuot75b5e6p38r47wdawu on "BillingRecurrence" (recurrence_time_of_year);
|
|
create index IDX3y752kr9uh4kh6uig54vemx0l on "Contact" (creation_time);
|
|
create index IDXtm415d6fe1rr35stm33s5mg18 on "Contact" (current_sponsor_registrar_id);
|
|
create index IDXn1f711wicdnooa2mqb7g1m55o on "Contact" (deletion_time);
|
|
create index IDX1p3esngcwwu6hstyua6itn6ff on "Contact" (search_name);
|
|
|
|
alter table if exists "Contact"
|
|
add constraint UKoqd7n4hbx86hvlgkilq75olas unique (contact_id);
|
|
create index IDX8nr0ke9mrrx4ewj6pd2ag4rmr on "Domain" (creation_time);
|
|
create index IDXhsjqiy2lyobfymplb28nm74lm on "Domain" (current_sponsor_registrar_id);
|
|
create index IDX5mnf0wn20tno4b9do88j61klr on "Domain" (deletion_time);
|
|
create index IDXc5aw4pk1vkd6ymhvkpanmoadv on "Domain" (domain_name);
|
|
create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld);
|
|
create index IDXfg2nnjlujxo6cb9fha971bq2n on "HostHistory" (creation_time);
|
|
create index IDX1iy7njgb7wjmj9piml4l2g0qi on "HostHistory" (history_registrar_id);
|
|
create index IDXkkwbwcwvrdkkqothkiye4jiff on "HostHistory" (host_name);
|
|
create index IDXknk8gmj7s47q56cwpa6rmpt5l on "HostHistory" (history_type);
|
|
create index IDX67qwkjtlq5q8dv6egtrtnhqi7 on "HostHistory" (history_modification_time);
|
|
create index IDXe7wu46c7wpvfmfnj4565abibp on "PollMessage" (registrar_id);
|
|
create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time);
|
|
create index premiumlist_name_idx on "PremiumList" (name);
|
|
create index registrar_name_idx on "Registrar" (registrar_name);
|
|
create index registrar_iana_identifier_idx on "Registrar" (iana_identifier);
|
|
create index registrarpoc_gae_user_id_idx on "RegistrarPoc" (gae_user_id);
|
|
create index idx_registry_lock_verification_code on "RegistryLock" (verification_code);
|
|
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
|
|
foreign key (revision_id)
|
|
references "ClaimsList";
|
|
|
|
alter table if exists "DomainHost"
|
|
add constraint FKeq1guccbre1yk3oosgp2io554
|
|
foreign key (domain_repo_id)
|
|
references "Domain";
|
|
|
|
alter table if exists "PremiumEntry"
|
|
add constraint FKo0gw90lpo1tuee56l0nb6y6g5
|
|
foreign key (revision_id)
|
|
references "PremiumList";
|
|
|
|
alter table if exists "RegistryLock"
|
|
add constraint FK2lhcwpxlnqijr96irylrh1707
|
|
foreign key (relock_revision_id)
|
|
references "RegistryLock";
|
|
|
|
alter table if exists "ReservedEntry"
|
|
add constraint FKgq03rk0bt1hb915dnyvd3vnfc
|
|
foreign key (revision_id)
|
|
references "ReservedList";
|