killbill-aplcache

beatrix: util: relax constraint on bus tables search_key1

7/15/2015 6:13:28 PM

Details

diff --git a/beatrix/src/main/resources/org/killbill/billing/beatrix/ddl.sql b/beatrix/src/main/resources/org/killbill/billing/beatrix/ddl.sql
index 64e4678..6ce6e8e 100644
--- a/beatrix/src/main/resources/org/killbill/billing/beatrix/ddl.sql
+++ b/beatrix/src/main/resources/org/killbill/billing/beatrix/ddl.sql
@@ -12,7 +12,8 @@ CREATE TABLE bus_ext_events (
     processing_available_date datetime DEFAULT NULL,
     processing_state varchar(14) DEFAULT 'AVAILABLE',
     error_count int /*! unsigned */ DEFAULT 0,
-    search_key1 bigint /*! unsigned */ not null,
+    /* Note: account_record_id can be NULL (e.g. TagDefinition events) */
+    search_key1 bigint /*! unsigned */ default null,
     search_key2 bigint /*! unsigned */ not null default 0,
     PRIMARY KEY(record_id)
 ) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
@@ -31,7 +32,8 @@ CREATE TABLE bus_ext_events_history (
     processing_available_date datetime DEFAULT NULL,
     processing_state varchar(14) DEFAULT 'AVAILABLE',
     error_count int /*! unsigned */ DEFAULT 0,
-    search_key1 bigint /*! unsigned */ not null,
+    /* Note: account_record_id can be NULL (e.g. TagDefinition events) */
+    search_key1 bigint /*! unsigned */ default null,
     search_key2 bigint /*! unsigned */ not null default 0,
     PRIMARY KEY(record_id)
 ) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
diff --git a/util/src/main/resources/org/killbill/billing/util/ddl.sql b/util/src/main/resources/org/killbill/billing/util/ddl.sql
index 62f19f8..fb009d4 100644
--- a/util/src/main/resources/org/killbill/billing/util/ddl.sql
+++ b/util/src/main/resources/org/killbill/billing/util/ddl.sql
@@ -206,7 +206,8 @@ CREATE TABLE bus_events (
     processing_available_date datetime DEFAULT NULL,
     processing_state varchar(14) DEFAULT 'AVAILABLE',
     error_count int /*! unsigned */ DEFAULT 0,
-    search_key1 bigint /*! unsigned */ not null,
+    /* Note: account_record_id can be NULL (e.g. TagDefinition events) */
+    search_key1 bigint /*! unsigned */ default null,
     search_key2 bigint /*! unsigned */ not null default 0,
     PRIMARY KEY(record_id)
 ) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
@@ -225,7 +226,8 @@ CREATE TABLE bus_events_history (
     processing_available_date datetime DEFAULT NULL,
     processing_state varchar(14) DEFAULT 'AVAILABLE',
     error_count int /*! unsigned */ DEFAULT 0,
-    search_key1 bigint /*! unsigned */ not null,
+    /* Note: account_record_id can be NULL (e.g. TagDefinition events) */
+    search_key1 bigint /*! unsigned */ default null,
     search_key2 bigint /*! unsigned */ not null default 0,
     PRIMARY KEY(record_id)
 ) /*! CHARACTER SET utf8 COLLATE utf8_bin */;