Details
diff --git a/account/src/main/resources/com/ning/billing/account/ddl.sql b/account/src/main/resources/com/ning/billing/account/ddl.sql
index 17e344a..c10aaf9 100644
--- a/account/src/main/resources/com/ning/billing/account/ddl.sql
+++ b/account/src/main/resources/com/ning/billing/account/ddl.sql
@@ -25,6 +25,7 @@ CREATE TABLE accounts (
created_by varchar(50) NOT NULL,
updated_date datetime DEFAULT NULL,
updated_by varchar(50) DEFAULT NULL,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX accounts_id ON accounts(id);
@@ -57,6 +58,7 @@ CREATE TABLE account_history (
change_type char(6) NOT NULL,
updated_by varchar(50) NOT NULL,
date datetime NOT NULL,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(history_record_id)
) ENGINE=innodb;
CREATE INDEX account_history_record_id ON account_history(record_id);
@@ -71,6 +73,8 @@ CREATE TABLE account_emails (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX account_email_id ON account_emails(id);
@@ -86,6 +90,8 @@ CREATE TABLE account_email_history (
change_type char(6) NOT NULL,
updated_by varchar(50) NOT NULL,
date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(history_record_id)
) ENGINE=innodb;
CREATE INDEX account_email_record_id ON account_email_history(record_id);
diff --git a/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql b/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql
index 53d6c48..3c0a2c6 100644
--- a/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql
+++ b/analytics/src/main/resources/com/ning/billing/analytics/ddl.sql
@@ -33,6 +33,8 @@ create table bst (
, next_currency varchar(50) default null
, next_start_date bigint default null
, next_state varchar(50) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Business Subscription Transitions, track bundles lifecycle';
create index bst_key_index on bst (external_key, requested_timestamp asc);
@@ -53,6 +55,8 @@ create table bac (
, credit_card_type varchar(50) default null
, billing_address_country varchar(50) default null
, currency char(50) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Business ACcounts, keep a record of all accounts';
create unique index bac_key_index on bac (account_key);
@@ -73,6 +77,8 @@ create table bin (
, amount_paid numeric(10, 4) default 0 comment 'Sums of the successful payments made for this invoice minus the refunds associated with this invoice'
, amount_charged numeric(10, 4) default 0 comment 'Sums of the invoice items amount'
, amount_credited numeric(10, 4) default 0 comment 'Sums of the credit items'
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Business INvoices, keep a record of generated invoices';
create unique index bin_key_index on bin (invoice_id);
@@ -96,6 +102,8 @@ create table bii (
, end_date date default null
, amount numeric(10, 4) default 0
, currency char(50) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Business Invoice Items, keep a record of all invoice items';
create unique index bii_key_index on bii (item_id);
@@ -122,6 +130,8 @@ create table bip (
, card_country varchar(50) default null
, invoice_payment_type varchar(50) default null
, linked_invoice_payment_id char(36) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Business Invoice Payments, track all payments';
create unique index bip_key_index on bip (payment_id);
@@ -135,6 +145,8 @@ create table bos (
, status varchar(50) not null
, start_date bigint default null
, end_date bigint default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Business Overdue Status, historical bundles overdue status';
create unique index bos_key_index on bos (external_key, status);
@@ -145,6 +157,8 @@ create table bac_tags (
, account_id char(36) not null
, account_key varchar(50) not null comment 'Account external key'
, name varchar(50) not null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Tags associated to accounts';
@@ -155,6 +169,8 @@ create table bac_fields (
, account_key varchar(50) not null comment 'Account external key'
, name varchar(50) not null
, value varchar(255) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Custom fields associated to accounts';
@@ -165,6 +181,8 @@ create table bst_tags (
, external_key varchar(50) not null comment 'Bundle external key'
, account_key varchar(50) not null comment 'Account external key'
, name varchar(50) not null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Tags associated to bundles';
@@ -176,6 +194,8 @@ create table bst_fields (
, account_key varchar(50) not null comment 'Account external key'
, name varchar(50) not null
, value varchar(255) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Custom fields associated to bundles';
@@ -184,6 +204,8 @@ create table bin_tags (
record_id int(11) unsigned not null auto_increment
, invoice_id char(36) not null
, name varchar(50) not null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Tags associated to invoices';
@@ -193,6 +215,8 @@ create table bin_fields (
, invoice_id char(36) not null
, name varchar(50) not null
, value varchar(255) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Custom fields associated to invoices';
@@ -201,6 +225,8 @@ create table bip_tags (
record_id int(11) unsigned not null auto_increment
, payment_id char(36) not null
, name varchar(50) not null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Tags associated to payments';
@@ -210,5 +236,7 @@ create table bip_fields (
, payment_id char(36) not null
, name varchar(50) not null
, value varchar(255) default null
+, account_record_id int(11) unsigned default null
+, tenant_record_id int(11) unsigned default null
, primary key(record_id)
) engine=innodb comment 'Custom fields associated to payments';
diff --git a/entitlement/src/main/resources/com/ning/billing/entitlement/ddl.sql b/entitlement/src/main/resources/com/ning/billing/entitlement/ddl.sql
index 66628e8..2b604e7 100644
--- a/entitlement/src/main/resources/com/ning/billing/entitlement/ddl.sql
+++ b/entitlement/src/main/resources/com/ning/billing/entitlement/ddl.sql
@@ -19,6 +19,8 @@ CREATE TABLE subscription_events (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX subscription_events_id ON subscription_events(id);
@@ -42,6 +44,8 @@ CREATE TABLE subscriptions (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX subscriptions_id ON subscriptions(id);
@@ -54,6 +58,8 @@ CREATE TABLE bundles (
external_key varchar(64) NOT NULL,
account_id char(36) NOT NULL,
last_sys_update_date datetime,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX bundles_id ON bundles(id);
diff --git a/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql b/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql
index fa8b276..5a6c063 100644
--- a/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql
+++ b/invoice/src/main/resources/com/ning/billing/invoice/ddl.sql
@@ -18,6 +18,8 @@ CREATE TABLE invoice_items (
linked_item_id char(36),
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
@@ -37,6 +39,8 @@ CREATE TABLE invoices (
migrated bool NOT NULL,
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX invoices_id ON invoices(id);
@@ -56,6 +60,8 @@ CREATE TABLE invoice_payments (
linked_invoice_payment_id char(36) DEFAULT NULL,
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX invoice_payments_id ON invoice_payments(id);
diff --git a/junction/src/main/resources/com/ning/billing/junction/ddl.sql b/junction/src/main/resources/com/ning/billing/junction/ddl.sql
index 92b3437..d7c595b 100644
--- a/junction/src/main/resources/com/ning/billing/junction/ddl.sql
+++ b/junction/src/main/resources/com/ning/billing/junction/ddl.sql
@@ -10,6 +10,8 @@ CREATE TABLE blocking_states (
block_entitlement bool NOT NULL,
block_billing bool NOT NULL,
created_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE INDEX blocking_states_id ON blocking_states(id);
\ No newline at end of file
diff --git a/payment/src/main/resources/com/ning/billing/payment/ddl.sql b/payment/src/main/resources/com/ning/billing/payment/ddl.sql
index a652b58..6d184f5 100644
--- a/payment/src/main/resources/com/ning/billing/payment/ddl.sql
+++ b/payment/src/main/resources/com/ning/billing/payment/ddl.sql
@@ -16,6 +16,8 @@ CREATE TABLE payments (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE UNIQUE INDEX payments_id ON payments(id);
@@ -39,6 +41,8 @@ CREATE TABLE payment_history (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (history_record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE INDEX payment_history_record_id ON payment_history(record_id);
@@ -56,6 +60,8 @@ CREATE TABLE payment_attempts (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE UNIQUE INDEX payment_attempts_id ON payment_attempts(id);
@@ -75,6 +81,8 @@ CREATE TABLE payment_attempt_history (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (history_record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE INDEX payment_attempt_history_record_id ON payment_attempt_history(record_id);
@@ -92,6 +100,8 @@ CREATE TABLE payment_methods (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE UNIQUE INDEX payment_methods_id ON payment_methods(id);
@@ -111,6 +121,8 @@ CREATE TABLE payment_method_history (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (history_record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE UNIQUE INDEX payment_method_history_record_id ON payment_method_history(record_id);
@@ -129,6 +141,8 @@ CREATE TABLE refunds (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE UNIQUE INDEX refunds_id ON refunds(id);
@@ -150,6 +164,8 @@ CREATE TABLE refund_history (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY (history_record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE INDEX refund_history_record_id ON refund_history(record_id);
diff --git a/util/src/main/resources/com/ning/billing/util/ddl.sql b/util/src/main/resources/com/ning/billing/util/ddl.sql
index acb8d69..b7a00f9 100644
--- a/util/src/main/resources/com/ning/billing/util/ddl.sql
+++ b/util/src/main/resources/com/ning/billing/util/ddl.sql
@@ -10,6 +10,8 @@ CREATE TABLE custom_fields (
created_date datetime NOT NULL,
updated_by varchar(50) DEFAULT NULL,
updated_date datetime DEFAULT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX custom_fields_id ON custom_fields(id);
@@ -28,12 +30,13 @@ CREATE TABLE custom_field_history (
updated_by varchar(50) NOT NULL,
date datetime NOT NULL,
change_type char(6) NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(history_record_id)
) ENGINE=innodb;
CREATE INDEX custom_field_history_record_id ON custom_field_history(record_id);
CREATE INDEX custom_field_history_object_id_object_type ON custom_fields(object_id, object_type);
-DROP TABLE IF EXISTS tag_descriptions;
DROP TABLE IF EXISTS tag_definitions;
CREATE TABLE tag_definitions (
record_id int(11) unsigned NOT NULL AUTO_INCREMENT,
@@ -44,6 +47,7 @@ CREATE TABLE tag_definitions (
created_date datetime NOT NULL,
updated_by varchar(50) NOT NULL,
updated_date datetime NOT NULL,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX tag_definitions_id ON tag_definitions(id);
@@ -60,6 +64,7 @@ CREATE TABLE tag_definition_history (
change_type char(6) NOT NULL,
updated_by varchar(50) NOT NULL,
date datetime NOT NULL,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(history_record_id)
) ENGINE=innodb;
CREATE INDEX tag_definition_history_id ON tag_definition_history(id);
@@ -75,6 +80,8 @@ CREATE TABLE tags (
object_type varchar(30) NOT NULL,
created_by varchar(50) NOT NULL,
created_date datetime NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE = innodb;
CREATE UNIQUE INDEX tags_id ON tags(id);
@@ -92,6 +99,8 @@ CREATE TABLE tag_history (
updated_by varchar(50) NOT NULL,
date datetime NOT NULL,
change_type char(6) NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(history_record_id)
) ENGINE = innodb;
CREATE INDEX tag_history_record_id ON tag_history(record_id);
@@ -104,13 +113,15 @@ CREATE TABLE notifications (
created_date datetime NOT NULL,
class_name varchar(256) NOT NULL,
account_id char(36),
- notification_key varchar(2048) NOT NULL,
- creating_owner char(50) NOT NULL,
+ notification_key varchar(2048) NOT NULL,
+ creating_owner char(50) NOT NULL,
effective_date datetime NOT NULL,
queue_name char(64) NOT NULL,
processing_owner char(50) DEFAULT NULL,
processing_available_date datetime DEFAULT NULL,
processing_state varchar(14) DEFAULT 'AVAILABLE',
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE UNIQUE INDEX notifications_id ON notifications(id);
@@ -124,6 +135,8 @@ CREATE TABLE claimed_notifications (
owner_id varchar(64) NOT NULL,
claimed_date datetime NOT NULL,
notification_id char(36) NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
@@ -138,6 +151,8 @@ CREATE TABLE audit_log (
reason_code varchar(20) DEFAULT NULL,
comments varchar(255) DEFAULT NULL,
user_token char(36),
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(id)
) ENGINE=innodb;
CREATE INDEX audit_log_fetch_record ON audit_log(table_name, record_id);
@@ -153,6 +168,8 @@ CREATE TABLE bus_events (
processing_owner char(50) DEFAULT NULL,
processing_available_date datetime DEFAULT NULL,
processing_state varchar(14) DEFAULT 'AVAILABLE',
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
) ENGINE=innodb;
CREATE INDEX `idx_bus_where` ON bus_events (`processing_state`,`processing_owner`,`creating_owner`,`processing_available_date`);
@@ -163,5 +180,7 @@ CREATE TABLE claimed_bus_events (
owner_id varchar(64) NOT NULL,
claimed_date datetime NOT NULL,
bus_event_id char(36) NOT NULL,
+ account_record_id int(11) unsigned default null,
+ tenant_record_id int(11) unsigned default null,
PRIMARY KEY(record_id)
-) ENGINE=innodb;
\ No newline at end of file
+) ENGINE=innodb;