Commit 61785098 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

*: use ROCKSDB instead of InnoDB.

parent 5166406d
...@@ -21,4 +21,4 @@ CREATE TABLE `accounting_transaction` ( ...@@ -21,4 +21,4 @@ CREATE TABLE `accounting_transaction` (
PRIMARY KEY (`uid`, `order_id`), PRIMARY KEY (`uid`, `order_id`),
KEY (`section_uid`, `mirror_section_uid`) KEY (`section_uid`, `mirror_section_uid`)
-- TODO: keys -- TODO: keys
) ENGINE=InnoDB ) ENGINE=ROCKSDB
...@@ -1340,7 +1340,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -1340,7 +1340,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`dummy_title` varchar(32) NOT NULL default '', `dummy_title` varchar(32) NOT NULL default '',
PRIMARY KEY (`uid`) PRIMARY KEY (`uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
""" """
drop_summy_table_sql = """ drop_summy_table_sql = """
DROP TABLE IF EXISTS `dummy` DROP TABLE IF EXISTS `dummy`
...@@ -2255,7 +2255,7 @@ CREATE TABLE `%s` ( ...@@ -2255,7 +2255,7 @@ CREATE TABLE `%s` (
`owner_reference` varchar(32) NOT NULL default '', `owner_reference` varchar(32) NOT NULL default '',
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `version` (`owner_reference`) KEY `version` (`owner_reference`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
""" % local_roles_table """ % local_roles_table
sql_catalog.newContent( sql_catalog.newContent(
portal_type='SQL Method', portal_type='SQL Method',
...@@ -2441,7 +2441,7 @@ CREATE TABLE `%s` ( ...@@ -2441,7 +2441,7 @@ CREATE TABLE `%s` (
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `assignee_reference` (`assignee_reference`), KEY `assignee_reference` (`assignee_reference`),
KEY `viewable_assignee_reference` (`viewable_assignee_reference`) KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
""" % local_roles_table """ % local_roles_table
sql_catalog.newContent( sql_catalog.newContent(
portal_type='SQL Method', portal_type='SQL Method',
...@@ -2612,7 +2612,7 @@ CREATE TABLE `%s` ( ...@@ -2612,7 +2612,7 @@ CREATE TABLE `%s` (
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `assignee_reference` (`assignee_reference`), KEY `assignee_reference` (`assignee_reference`),
KEY `viewable_assignee_reference` (`viewable_assignee_reference`) KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
""" % local_roles_table """ % local_roles_table
sql_catalog.newContent( sql_catalog.newContent(
portal_type='SQL Method', portal_type='SQL Method',
...@@ -2876,7 +2876,7 @@ CREATE TABLE `%s` ( ...@@ -2876,7 +2876,7 @@ CREATE TABLE `%s` (
`viewable_assignee_reference` varchar(32) NOT NULL default '', `viewable_assignee_reference` varchar(32) NOT NULL default '',
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `viewable_assignee_reference` (`viewable_assignee_reference`) KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
""" % local_roles_table """ % local_roles_table
sql_catalog.newContent( sql_catalog.newContent(
portal_type='SQL Method', portal_type='SQL Method',
...@@ -3110,7 +3110,7 @@ CREATE TABLE `%s` ( ...@@ -3110,7 +3110,7 @@ CREATE TABLE `%s` (
`viewable_assignee_reference` varchar(32) NOT NULL default '', `viewable_assignee_reference` varchar(32) NOT NULL default '',
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `viewable_assignee_reference` (`viewable_assignee_reference`) KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
""" % local_roles_table """ % local_roles_table
sql_catalog.newContent( sql_catalog.newContent(
portal_type='SQL Method', portal_type='SQL Method',
......
...@@ -4,4 +4,4 @@ CREATE TABLE `crawler` ( ...@@ -4,4 +4,4 @@ CREATE TABLE `crawler` (
`creation_date_index` INT, `creation_date_index` INT,
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `creation_date_index` (`creation_date_index`, `frequency_index`) KEY `creation_date_index` (`creation_date_index`, `frequency_index`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -13,4 +13,4 @@ CREATE TABLE `email_thread` ( ...@@ -13,4 +13,4 @@ CREATE TABLE `email_thread` (
KEY `bcc_recipient` (`bcc_recipient`), KEY `bcc_recipient` (`bcc_recipient`),
KEY `validation_state` (`validation_state`), KEY `validation_state` (`validation_state`),
KEY `start_date` (`start_date`, `validation_state`) KEY `start_date` (`start_date`, `validation_state`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
\ No newline at end of file \ No newline at end of file
...@@ -6,4 +6,4 @@ CREATE TABLE `full_text` ( ...@@ -6,4 +6,4 @@ CREATE TABLE `full_text` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`SearchableText` MEDIUMTEXT, `SearchableText` MEDIUMTEXT,
PRIMARY KEY (`uid`) PRIMARY KEY (`uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -3,4 +3,4 @@ CREATE TABLE `email` ( ...@@ -3,4 +3,4 @@ CREATE TABLE `email` (
`url_string` varchar(255), `url_string` varchar(255),
PRIMARY KEY `uid` (`uid`), PRIMARY KEY `uid` (`uid`),
KEY `url_string` (`url_string`) KEY `url_string` (`url_string`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
\ No newline at end of file \ No newline at end of file
...@@ -22,4 +22,4 @@ CREATE TABLE `movement` ( ...@@ -22,4 +22,4 @@ CREATE TABLE `movement` (
KEY `resource_uid` (`resource_uid`), KEY `resource_uid` (`resource_uid`),
KEY `is_accountable` (`is_accountable`), KEY `is_accountable` (`is_accountable`),
KEY `variation_text` (`variation_text`) KEY `variation_text` (`variation_text`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -2,4 +2,4 @@ CREATE TABLE reporting_outcome ( ...@@ -2,4 +2,4 @@ CREATE TABLE reporting_outcome (
uid BIGINT UNSIGNED NOT NULL, uid BIGINT UNSIGNED NOT NULL,
outcome_description VARCHAR(255), outcome_description VARCHAR(255),
PRIMARY KEY `uid` (`uid`) PRIMARY KEY `uid` (`uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -5,4 +5,4 @@ CREATE TABLE roles_and_users ( ...@@ -5,4 +5,4 @@ CREATE TABLE roles_and_users (
KEY `uid` (`uid`), KEY `uid` (`uid`),
KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`), KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`),
KEY `local_roles_group_id` (`local_roles_group_id`) KEY `local_roles_group_id` (`local_roles_group_id`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -4,4 +4,4 @@ Create table `inventory_cache` ( ...@@ -4,4 +4,4 @@ Create table `inventory_cache` (
`result` LONGBLOB NOT NULL, `result` LONGBLOB NOT NULL,
PRIMARY KEY (`query`, `date`), PRIMARY KEY (`query`, `date`),
KEY (`date`) KEY (`date`)
) Engine=InnoDB ) Engine=ROCKSDB
\ No newline at end of file \ No newline at end of file
...@@ -4,4 +4,4 @@ CREATE TABLE `syncml` ( ...@@ -4,4 +4,4 @@ CREATE TABLE `syncml` (
`data` LONGBLOB NULL, `data` LONGBLOB NULL,
PRIMARY KEY (`path`), PRIMARY KEY (`path`),
KEY `gid` (`gid`,`path`) KEY `gid` (`gid`,`path`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -30,4 +30,4 @@ CREATE TABLE `worklist_cache` ( ...@@ -30,4 +30,4 @@ CREATE TABLE `worklist_cache` (
KEY `portal_simulation_owner` (`portal_type`, `simulation_state`, `viewable_owner`), KEY `portal_simulation_owner` (`portal_type`, `simulation_state`, `viewable_owner`),
KEY `portal_validation_security` (`portal_type`, `validation_state`, `security_uid`), KEY `portal_validation_security` (`portal_type`, `validation_state`, `security_uid`),
KEY `portal_validation_owner` (`portal_type`, `validation_state`, `viewable_owner`) KEY `portal_validation_owner` (`portal_type`, `validation_state`, `viewable_owner`)
) ENGINE=InnoDB ) ENGINE=ROCKSDB
\ No newline at end of file \ No newline at end of file
...@@ -2,4 +2,4 @@ CREATE TABLE `portal_ids` ( ...@@ -2,4 +2,4 @@ CREATE TABLE `portal_ids` (
`id_group` VARBINARY(255), `id_group` VARBINARY(255),
`last_id` BIGINT UNSIGNED, `last_id` BIGINT UNSIGNED,
PRIMARY KEY (`id_group`) PRIMARY KEY (`id_group`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ CREATE TABLE `portal_ids` ( ...@@ -2,7 +2,7 @@ CREATE TABLE `portal_ids` (
`id_group` VARBINARY(255), `id_group` VARBINARY(255),
`last_id` BIGINT UNSIGNED, `last_id` BIGINT UNSIGNED,
PRIMARY KEY (`id_group`) PRIMARY KEY (`id_group`)
) ENGINE=InnoDB ) ENGINE=ROCKSDB
<dtml-var sql_delimiter> <dtml-var sql_delimiter>
<dtml-in expr="getPortalObject().portal_ids.getDictLengthIdsItems()"> <dtml-in expr="getPortalObject().portal_ids.getDictLengthIdsItems()">
INSERT INTO `portal_ids` (`id_group`, `last_id`) VALUES (<dtml-sqlvar sequence-key type="string">, <dtml-sqlvar sequence-item type="int">) INSERT INTO `portal_ids` (`id_group`, `last_id`) VALUES (<dtml-sqlvar sequence-key type="string">, <dtml-sqlvar sequence-item type="int">)
......
...@@ -6,4 +6,4 @@ CREATE TABLE `alarm` ( ...@@ -6,4 +6,4 @@ CREATE TABLE `alarm` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`alarm_date` DATETIME, `alarm_date` DATETIME,
PRIMARY KEY (`uid`) PRIMARY KEY (`uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -54,4 +54,4 @@ CREATE TABLE `catalog` ( ...@@ -54,4 +54,4 @@ CREATE TABLE `catalog` (
KEY `invoice_state` (`invoice_state`), KEY `invoice_state` (`invoice_state`),
KEY `payment_state` (`payment_state`), KEY `payment_state` (`payment_state`),
KEY `event_state` (`event_state`) KEY `event_state` (`event_state`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -9,4 +9,4 @@ CREATE TABLE `category` ( ...@@ -9,4 +9,4 @@ CREATE TABLE `category` (
`category_strict_membership` tinyint(1) default '0', `category_strict_membership` tinyint(1) default '0',
PRIMARY KEY (`uid`, `category_uid`, `base_category_uid`, `category_strict_membership`), PRIMARY KEY (`uid`, `category_uid`, `base_category_uid`, `category_strict_membership`),
KEY `Membership` (`category_uid`,`base_category_uid`) KEY `Membership` (`category_uid`,`base_category_uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
\ No newline at end of file \ No newline at end of file
...@@ -18,4 +18,4 @@ CREATE TABLE `delivery` ( ...@@ -18,4 +18,4 @@ CREATE TABLE `delivery` (
KEY `destination_section_uid` (`destination_section_uid`), KEY `destination_section_uid` (`destination_section_uid`),
KEY `resource_uid` (`resource_uid`), KEY `resource_uid` (`resource_uid`),
KEY `start_date` (`start_date`) KEY `start_date` (`start_date`)
) ENGINE=InnoDB ) ENGINE=ROCKSDB
...@@ -18,4 +18,4 @@ CREATE TABLE `item` ( ...@@ -18,4 +18,4 @@ CREATE TABLE `item` (
KEY `variation_text` (`variation_text`), KEY `variation_text` (`variation_text`),
KEY `aggregate_simulation_state_date` (`aggregate_uid`,`simulation_state`,`date`), KEY `aggregate_simulation_state_date` (`aggregate_uid`,`simulation_state`,`date`),
KEY `node_simulation_state_date` (`node_uid`,`simulation_state`,`date`) KEY `node_simulation_state_date` (`node_uid`,`simulation_state`,`date`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -6,4 +6,4 @@ CREATE TABLE `measure` ( ...@@ -6,4 +6,4 @@ CREATE TABLE `measure` (
`quantity` REAL NOT NULL, `quantity` REAL NOT NULL,
PRIMARY KEY (`uid`, `variation`), PRIMARY KEY (`uid`, `variation`),
KEY (`metric_type_uid`) KEY (`metric_type_uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -7,4 +7,4 @@ CREATE TABLE predicate ( ...@@ -7,4 +7,4 @@ CREATE TABLE predicate (
`start_date_range_min` datetime , `start_date_range_min` datetime ,
`start_date_range_max` datetime , `start_date_range_max` datetime ,
PRIMARY KEY `uid` (`uid`) PRIMARY KEY `uid` (`uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -10,4 +10,4 @@ CREATE TABLE `predicate_category` ( ...@@ -10,4 +10,4 @@ CREATE TABLE `predicate_category` (
PRIMARY KEY (`uid`, `category_uid`, `base_category_uid`, `category_strict_membership`), PRIMARY KEY (`uid`, `category_uid`, `base_category_uid`, `category_strict_membership`),
KEY `category_strict_membership` (`category_strict_membership`), KEY `category_strict_membership` (`category_strict_membership`),
KEY `Membership` (`category_uid`,`base_category_uid`) KEY `Membership` (`category_uid`,`base_category_uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -5,4 +5,4 @@ CREATE TABLE `quantity_unit_conversion` ( ...@@ -5,4 +5,4 @@ CREATE TABLE `quantity_unit_conversion` (
`quantity` REAL NOT NULL, `quantity` REAL NOT NULL,
PRIMARY KEY (`resource_uid`, `quantity_unit_uid`), PRIMARY KEY (`resource_uid`, `quantity_unit_uid`),
KEY (`uid`) KEY (`uid`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -11,4 +11,4 @@ CREATE TABLE `record` ( ...@@ -11,4 +11,4 @@ CREATE TABLE `record` (
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `played` (`played`), KEY `played` (`played`),
KEY `date` (`date`) KEY `date` (`date`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -3,4 +3,4 @@ CREATE TABLE roles_and_users ( ...@@ -3,4 +3,4 @@ CREATE TABLE roles_and_users (
allowedRolesAndUsers VARCHAR(255), allowedRolesAndUsers VARCHAR(255),
KEY `uid` (`uid`), KEY `uid` (`uid`),
KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`) KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -44,4 +44,4 @@ CREATE TABLE `stock` ( ...@@ -44,4 +44,4 @@ CREATE TABLE `stock` (
KEY `resource_node_uid` (`resource_uid`, `node_uid`), KEY `resource_node_uid` (`resource_uid`, `node_uid`),
KEY `resource_section_node_uid` (`resource_uid`, `section_uid`, `node_uid`, `simulation_state`), KEY `resource_section_node_uid` (`resource_uid`, `section_uid`, `node_uid`, `simulation_state`),
KEY `date` (`date`) KEY `date` (`date`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -3,4 +3,4 @@ CREATE TABLE subject ( ...@@ -3,4 +3,4 @@ CREATE TABLE subject (
subject VARCHAR(255), subject VARCHAR(255),
KEY `subject_set_uid` (`subject_set_uid`), KEY `subject_set_uid` (`subject_set_uid`),
KEY `subject` (`subject`) KEY `subject` (`subject`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -6,4 +6,4 @@ CREATE TABLE `transformation` ( ...@@ -6,4 +6,4 @@ CREATE TABLE `transformation` (
`quantity` double, `quantity` double,
KEY `resource` (`uid`, `variation_text`), KEY `resource` (`uid`, `variation_text`),
KEY `transformed_resource` (`transformed_uid`, `transformed_variation_text`) KEY `transformed_resource` (`transformed_uid`, `transformed_variation_text`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -7,4 +7,4 @@ CREATE TABLE translation ( ...@@ -7,4 +7,4 @@ CREATE TABLE translation (
KEY `message` (`translated_message`), KEY `message` (`translated_message`),
KEY `original_message` (`original_message`), KEY `original_message` (`original_message`),
KEY `type_translated_message` (`portal_type`,`translated_message`) KEY `type_translated_message` (`portal_type`,`translated_message`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -3,4 +3,4 @@ CREATE TABLE `user` ( ...@@ -3,4 +3,4 @@ CREATE TABLE `user` (
`user_id` varchar(255) binary default '', `user_id` varchar(255) binary default '',
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `user_id` (`user_id`) KEY `user_id` (`user_id`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -16,4 +16,4 @@ CREATE TABLE `versioning` ( ...@@ -16,4 +16,4 @@ CREATE TABLE `versioning` (
KEY `effective_date` (`effective_date`), KEY `effective_date` (`effective_date`),
KEY `expiration_date` (`expiration_date`), KEY `expiration_date` (`expiration_date`),
KEY `frequency_index` (`creation_date_index`, `frequency_index`) KEY `frequency_index` (`creation_date_index`, `frequency_index`)
) ENGINE=InnoDB; ) ENGINE=ROCKSDB;
...@@ -66,13 +66,13 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -66,13 +66,13 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.query("SELECT a, b FROM X") self.query("SELECT a, b FROM X")
def test_remove_column(self): def test_remove_column(self):
...@@ -82,12 +82,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -82,12 +82,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.query("SELECT b FROM X") self.query("SELECT b FROM X")
with self.assertRaisesRegex(OperationalError, with self.assertRaisesRegex(OperationalError,
"Unknown column 'a' in 'field list'"): "Unknown column 'a' in 'field list'"):
...@@ -99,12 +99,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -99,12 +99,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.query("SELECT b FROM X") self.query("SELECT b FROM X")
with self.assertRaisesRegex(OperationalError, with self.assertRaisesRegex(OperationalError,
"Unknown column 'a' in 'field list'"): "Unknown column 'a' in 'field list'"):
...@@ -116,12 +116,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -116,12 +116,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` varchar(10) DEFAULT NULL `a` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
# insterting '1' will be casted as int # insterting '1' will be casted as int
self.query("INSERT INTO X VALUES ('1')") self.query("INSERT INTO X VALUES ('1')")
self.assertEqual((1,), self.query("SELECT a FROM X")[1][0]) self.assertEqual((1,), self.query("SELECT a FROM X")[1][0])
...@@ -132,12 +132,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -132,12 +132,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT 123 `a` int(11) DEFAULT 123
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.query("INSERT INTO X VALUES ()") self.query("INSERT INTO X VALUES ()")
self.assertEqual((123,), self.query("SELECT a FROM X")[1][0]) self.assertEqual((123,), self.query("SELECT a FROM X")[1][0])
...@@ -147,12 +147,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -147,12 +147,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) NOT NULL COMMENT 'old comment' `a` int(11) NOT NULL COMMENT 'old comment'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) NOT NULL COMMENT 'new comment' `a` int(11) NOT NULL COMMENT 'new comment'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.assertEqual( self.assertEqual(
('a', 'new comment'), ('a', 'new comment'),
self.query( self.query(
...@@ -170,13 +170,13 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -170,13 +170,13 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
KEY `idx_a` (`a`) KEY `idx_a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.query("SELECT * FROM X USE INDEX (`idx_a`)") self.query("SELECT * FROM X USE INDEX (`idx_a`)")
def test_remove_index(self): def test_remove_index(self):
...@@ -186,12 +186,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -186,12 +186,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
KEY `idx_a` (`a`) KEY `idx_a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
with self.assertRaisesRegex(OperationalError, with self.assertRaisesRegex(OperationalError,
"Key 'idx_a' doesn't exist in table 'X'"): "Key 'idx_a' doesn't exist in table 'X'"):
self.query("SELECT * FROM X USE INDEX (`idx_a`)") self.query("SELECT * FROM X USE INDEX (`idx_a`)")
...@@ -204,14 +204,14 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -204,14 +204,14 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
`drop` int(11) DEFAULT NULL, `drop` int(11) DEFAULT NULL,
`alter` int(11) DEFAULT NULL, `alter` int(11) DEFAULT NULL,
KEY `CASE` (`drop`) KEY `CASE` (`drop`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `table` ( CREATE TABLE `table` (
`and` int(11) DEFAULT NULL, `and` int(11) DEFAULT NULL,
`alter` varchar(255) CHARACTER SET cp1250 COLLATE cp1250_croatian_ci DEFAULT 'BETWEEN', `alter` varchar(255) CHARACTER SET cp1250 COLLATE cp1250_croatian_ci DEFAULT 'BETWEEN',
KEY `use` (`alter`) KEY `use` (`alter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
table_name='table') table_name='table')
self.query( self.query(
"SELECT `alter`, `and` FROM `table` USE INDEX (`use`)") "SELECT `alter`, `and` FROM `table` USE INDEX (`use`)")
...@@ -227,9 +227,9 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -227,9 +227,9 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
self.assertEqual( self.assertEqual(
('X', 'InnoDB'), ('X', 'ROCKSDB'),
self.query( self.query(
dedent( dedent(
"""\ """\
...@@ -245,12 +245,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -245,12 +245,12 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='old comment'"""), ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='old comment'"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='new comment'""")) ) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='new comment'"""))
self.assertEqual( self.assertEqual(
('X', 'new comment'), ('X', 'new comment'),
self.query( self.query(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment