Details
diff --git a/util/src/test/java/org/killbill/billing/DBTestingHelper.java b/util/src/test/java/org/killbill/billing/DBTestingHelper.java
index cd9c246..9466add 100644
--- a/util/src/test/java/org/killbill/billing/DBTestingHelper.java
+++ b/util/src/test/java/org/killbill/billing/DBTestingHelper.java
@@ -59,7 +59,7 @@ public class DBTestingHelper extends PlatformDBTestingHelper {
// We always want the accounts and tenants table
instance.executeScript("drop table if exists accounts;" +
"CREATE TABLE accounts (\n" +
- " record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,\n" +
+ " record_id serial unique,\n" +
" id char(36) NOT NULL,\n" +
" external_key varchar(128) NULL,\n" +
" email varchar(128) NOT NULL,\n" +
@@ -85,12 +85,12 @@ public class DBTestingHelper extends PlatformDBTestingHelper {
" created_by varchar(50) NOT NULL,\n" +
" updated_date datetime DEFAULT NULL,\n" +
" updated_by varchar(50) DEFAULT NULL,\n" +
- " tenant_record_id int(11) /*! unsigned */ default null,\n" +
+ " tenant_record_id bigint /*! unsigned */ not null default 0,\n" +
" PRIMARY KEY(record_id)\n" +
");");
instance.executeScript("DROP TABLE IF EXISTS tenants;\n" +
"CREATE TABLE tenants (\n" +
- " record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,\n" +
+ " record_id serial unique,\n" +
" id char(36) NOT NULL,\n" +
" external_key varchar(128) NULL,\n" +
" api_key varchar(128) NULL,\n" +
@@ -106,7 +106,7 @@ public class DBTestingHelper extends PlatformDBTestingHelper {
// We always want the basic tables when we do account_record_id lookups (e.g. for custom fields, tags or junction)
instance.executeScript("DROP TABLE IF EXISTS bundles;\n" +
"CREATE TABLE bundles (\n" +
- " record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,\n" +
+ " record_id serial unique,\n" +
" id char(36) NOT NULL,\n" +
" external_key varchar(64) NOT NULL,\n" +
" account_id char(36) NOT NULL,\n" +
@@ -115,34 +115,34 @@ public class DBTestingHelper extends PlatformDBTestingHelper {
" created_date datetime NOT NULL,\n" +
" updated_by varchar(50) NOT NULL,\n" +
" updated_date datetime NOT NULL,\n" +
- " account_record_id int(11) /*! unsigned */ default null,\n" +
- " tenant_record_id int(11) /*! unsigned */ default null,\n" +
+ " account_record_id bigint /*! unsigned */ not null,\n" +
+ " tenant_record_id bigint /*! unsigned */ not null default 0,\n" +
" PRIMARY KEY(record_id)\n" +
");");
instance.executeScript("DROP TABLE IF EXISTS subscriptions;\n" +
"CREATE TABLE subscriptions (\n" +
- " record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,\n" +
+ " record_id serial unique,\n" +
" id char(36) NOT NULL,\n" +
" bundle_id char(36) NOT NULL,\n" +
" category varchar(32) NOT NULL,\n" +
" start_date datetime NOT NULL,\n" +
" bundle_start_date datetime NOT NULL,\n" +
- " active_version int(11) DEFAULT 1,\n" +
+ " active_version int DEFAULT 1,\n" +
" charged_through_date datetime DEFAULT NULL,\n" +
" paid_through_date datetime DEFAULT NULL,\n" +
" created_by varchar(50) NOT NULL,\n" +
" created_date datetime NOT NULL,\n" +
" updated_by varchar(50) NOT NULL,\n" +
" updated_date datetime NOT NULL,\n" +
- " account_record_id int(11) /*! unsigned */ default null,\n" +
- " tenant_record_id int(11) /*! unsigned */ default null,\n" +
+ " account_record_id bigint /*! unsigned */ not null,\n" +
+ " tenant_record_id bigint /*! unsigned */ not null default 0,\n" +
" PRIMARY KEY(record_id)\n" +
");");
// HACK (PIERRE): required by invoice tests which perform payments lookups to find the account record id for the internal callcontext
instance.executeScript("DROP TABLE IF EXISTS payments;\n" +
"CREATE TABLE payments (\n" +
- " record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,\n" +
+ " record_id serial unique,\n" +
" id char(36) NOT NULL,\n" +
" account_id char(36) NOT NULL,\n" +
" invoice_id char(36) NOT NULL,\n" +
@@ -155,8 +155,8 @@ public class DBTestingHelper extends PlatformDBTestingHelper {
" created_date datetime NOT NULL,\n" +
" updated_by varchar(50) NOT NULL,\n" +
" updated_date datetime NOT NULL,\n" +
- " account_record_id int(11) /*! unsigned */ default null,\n" +
- " tenant_record_id int(11) /*! unsigned */ default null,\n" +
+ " account_record_id bigint /*! unsigned */ not null,\n" +
+ " tenant_record_id bigint /*! unsigned */ not null default 0,\n" +
" PRIMARY KEY (record_id)\n" +
");");
diff --git a/util/src/test/java/org/killbill/billing/util/callcontext/TestInternalCallContextFactory.java b/util/src/test/java/org/killbill/billing/util/callcontext/TestInternalCallContextFactory.java
index 6e0eba4..0c4d6ae 100644
--- a/util/src/test/java/org/killbill/billing/util/callcontext/TestInternalCallContextFactory.java
+++ b/util/src/test/java/org/killbill/billing/util/callcontext/TestInternalCallContextFactory.java
@@ -41,7 +41,7 @@ public class TestInternalCallContextFactory extends UtilTestSuiteWithEmbeddedDB
public Void withHandle(final Handle handle) throws Exception {
handle.execute("DROP TABLE IF EXISTS invoices;\n" +
"CREATE TABLE invoices (\n" +
- " record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,\n" +
+ " record_id serial unique,\n" +
" id char(36) NOT NULL,\n" +
" account_id char(36) NOT NULL,\n" +
" invoice_date date NOT NULL,\n" +
@@ -50,8 +50,8 @@ public class TestInternalCallContextFactory extends UtilTestSuiteWithEmbeddedDB
" migrated bool NOT NULL,\n" +
" created_by varchar(50) NOT NULL,\n" +
" created_date datetime NOT NULL,\n" +
- " account_record_id int(11) /*! unsigned */ default null,\n" +
- " tenant_record_id int(11) /*! unsigned */ default null,\n" +
+ " account_record_id bigint /*! unsigned */ not null,\n" +
+ " tenant_record_id bigint /*! unsigned */ not null default 0,\n" +
" PRIMARY KEY(record_id)\n" +
");");
handle.execute("insert into invoices (id, account_id, invoice_date, target_date, currency, migrated, created_by, created_date, account_record_id) values " +
diff --git a/util/src/test/java/org/killbill/billing/util/export/dao/TestDatabaseExportDao.java b/util/src/test/java/org/killbill/billing/util/export/dao/TestDatabaseExportDao.java
index 0483a20..0752efd 100644
--- a/util/src/test/java/org/killbill/billing/util/export/dao/TestDatabaseExportDao.java
+++ b/util/src/test/java/org/killbill/billing/util/export/dao/TestDatabaseExportDao.java
@@ -54,16 +54,16 @@ public class TestDatabaseExportDao extends UtilTestSuiteWithEmbeddedDB {
@Override
public Void withHandle(final Handle handle) throws Exception {
handle.execute("drop table if exists " + tableNameA);
- handle.execute("create table " + tableNameA + "(record_id int(11) /*! unsigned */ not null auto_increment," +
+ handle.execute("create table " + tableNameA + "(record_id serial unique," +
"a_column char default 'a'," +
- "account_record_id int(11) /*! unsigned */ not null," +
- "tenant_record_id int(11) /*! unsigned */ default 0," +
+ "account_record_id bigint /*! unsigned */ not null," +
+ "tenant_record_id bigint /*! unsigned */ not null default 0," +
"primary key(record_id));");
handle.execute("drop table if exists " + tableNameB);
- handle.execute("create table " + tableNameB + "(record_id int(11) /*! unsigned */ not null auto_increment," +
+ handle.execute("create table " + tableNameB + "(record_id serial unique," +
"b_column char default 'b'," +
- "account_record_id int(11) /*! unsigned */ not null," +
- "tenant_record_id int(11) /*! unsigned */ default 0," +
+ "account_record_id bigint /*! unsigned */ not null," +
+ "tenant_record_id bigint /*! unsigned */ not null default 0," +
"primary key(record_id));");
handle.execute("insert into " + tableNameA + " (account_record_id, tenant_record_id) values (?, ?)",
internalCallContext.getAccountRecordId(), internalCallContext.getTenantRecordId());
diff --git a/util/src/test/resources/org/killbill/billing/util/ddl_test.sql b/util/src/test/resources/org/killbill/billing/util/ddl_test.sql
index 0f6aa57..f548887 100644
--- a/util/src/test/resources/org/killbill/billing/util/ddl_test.sql
+++ b/util/src/test/resources/org/killbill/billing/util/ddl_test.sql
@@ -9,7 +9,7 @@ CREATE TABLE dummy (
DROP TABLE IF EXISTS dummy2;
CREATE TABLE dummy2 (
- id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,
+ id serial unique,
dummy_id char(36) NOT NULL,
PRIMARY KEY(id)
);
@@ -24,19 +24,19 @@ CREATE TABLE validation_test (
DROP TABLE IF EXISTS kombucha;
CREATE TABLE kombucha (
- record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,
+ record_id serial unique,
id char(36) NOT NULL,
tea varchar(50) NOT NULL,
mushroom varchar(50) NOT NULL,
sugar varchar(50) NOT NULL,
- account_record_id int(11) /*! unsigned */ default null,
- tenant_record_id int(11) /*! unsigned */ default null,
+ account_record_id bigint unsigned not null,
+ tenant_record_id bigint unsigned not null default 0,
PRIMARY KEY(record_id)
);
DROP TABLE IF EXISTS full_of_dates;
CREATE TABLE full_of_dates (
- record_id int(11) /*! unsigned */ NOT NULL AUTO_INCREMENT,
+ record_id serial unique,
date1 date default NULL,
datetime1 datetime default NULL,
timestamp1 timestamp,