Generate sql schema for BillingEvent (#565)

* Generate sql schema for BillingEvent

* Change to use sequence

* Address comments

* Resolve warnings and remove duplicate cost related fields

* Increase the flayway file version to V25

* Remove extra space

* Split to 3 tables, merge VKey

* Rename talbes

* Rename repoId to domainRepoId

* Exclude VKey in schema.txt

* Rename target_id to domain_name

* Fix javadoc

* Resolve comments
This commit is contained in:
Shicong Huang 2020-05-27 15:59:19 -04:00 committed by GitHub
parent 02e43ab134
commit cf092c7e50
22 changed files with 941 additions and 179 deletions

View file

@ -12,6 +12,54 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
create table "BillingCancellation" (
billing_cancellation_id bigserial not null,
client_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,
client_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,
client_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,
@ -280,6 +328,18 @@
should_publish boolean not null,
primary key (revision_id)
);
create index IDXeokttmxtpq2hohcioe5t2242b on "BillingCancellation" (client_id);
create index IDX2exdfbx6oiiwnhr8j6gjpqt2j on "BillingCancellation" (event_time);
create index IDXqa3g92jc17e8dtiaviy4fet4x on "BillingCancellation" (billing_time);
create index IDX73l103vc5900ig3p4odf0cngt on "BillingEvent" (client_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 IDXn898pb9mwcg359cdwvolb11ck on "BillingRecurrence" (client_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 IDXbn8t4wp85fgxjl8q4ctlscx55 on "Contact" (current_sponsor_client_id);
create index IDXn1f711wicdnooa2mqb7g1m55o on "Contact" (deletion_time);