-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
ddl.sql
60 lines (57 loc) · 2.35 KB
/
ddl.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Copyright 2014-2020 Groupon, Inc
* Copyright 2020-2020 Equinix, Inc
* Copyright 2014-2020 The Billing Project, LLC
*
* The Billing Project licenses this file to you 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.
*/
/*! SET default_storage_engine=INNODB */;
drop table if exists avatax_responses;
create table avatax_responses (
record_id serial unique
, kb_account_id char(36) not null
, kb_invoice_id char(36) not null
, kb_invoice_item_ids longtext default null
, doc_code varchar(255) default null
, doc_date datetime default null
, timestamp datetime default null
, total_amount numeric(15,9) default null
, total_discount numeric(15,9) default null
, total_exemption numeric(15,9) default null
, total_taxable numeric(15,9) default null
, total_tax numeric(15,9) default null
, total_tax_calculated numeric(15,9) default null
, tax_date datetime default null
, tax_lines longtext default null
, tax_summary longtext default null
, tax_addresses longtext default null
, result_code varchar(255) default null
, messages longtext default null
, additional_data longtext default null
, created_date datetime not null
, kb_tenant_id char(36) not null
, primary key(record_id)
) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
create index avatax_responses_kb_account_id on avatax_responses(kb_account_id);
create index avatax_responses_kb_invoice_id on avatax_responses(kb_invoice_id);
drop table if exists avatax_tax_codes;
create table avatax_tax_codes (
record_id serial unique
, product_name varchar(255) not null
, tax_code varchar(255) not null
, created_date datetime not null
, kb_tenant_id char(36) not null
, primary key(record_id)
) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
create index avatax_tax_codes_product_name on avatax_tax_codes(product_name);
create unique index avatax_tax_codes_product_name_tax_code_kb_tenant_id on avatax_tax_codes(product_name, tax_code, kb_tenant_id);