Commit d092df72 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_{mysql,security_uid}_innodb_catalog: Reduce disk usage.

Replace several varchar columns to save 2 bytes (when upgrading from utf8
encoding) or 3 bytes (when upgrading from utf8mb4) per character.
Mark columns as "not null" to save one bit per column (so about one byte
per 8 columns "not null"-ified, depending on how many null-able columns
remain).
parent 35c20cf9
CREATE TABLE roles_and_users ( CREATE TABLE roles_and_users (
uid INT UNSIGNED, uid INT UNSIGNED,
local_roles_group_id VARCHAR(255) default '', local_roles_group_id varbinary(255) NOT NULL default '',
allowedRolesAndUsers VARCHAR(255), allowedRolesAndUsers varbinary(255) NOT NULL,
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`)
......
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
CREATE TABLE `alarm` ( 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`),
KEY `alarm_date` (`alarm_date`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
...@@ -5,31 +5,31 @@ ...@@ -5,31 +5,31 @@
CREATE TABLE `catalog` ( CREATE TABLE `catalog` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`security_uid` INT UNSIGNED, `security_uid` INT UNSIGNED,
`owner` varbinary(255) NOT NULL default '', `owner` varbinary(255) default '',
`viewable_owner` varbinary(255) NOT NULL default '', `viewable_owner` varbinary(255) default '',
`path` varchar(255) NOT NULL default '', `path` varbinary(255) NOT NULL default '',
`relative_url` varchar(255) NOT NULL default '', `relative_url` varbinary(255) NOT NULL default '',
`parent_uid` BIGINT UNSIGNED default '0', `parent_uid` BIGINT UNSIGNED default 0,
`id` varchar(255) default '', `id` varbinary(255) NOT NULL default '',
`description` text, `description` text,
`title` varchar(255) default '', `title` varchar(255) default '',
`meta_type` varchar(255) default '', `meta_type` varbinary(255) default '',
`portal_type` varchar(255) default '', `portal_type` varbinary(255) NOT NULL default '',
`opportunity_state` varchar(255) default '', `opportunity_state` varbinary(255) default '',
`corporate_registration_code` varchar(255), `corporate_registration_code` varchar(255),
`ean13_code` varchar(255), `ean13_code` varchar(255),
`validation_state` varchar(255) default '', `validation_state` varbinary(255) default '',
`simulation_state` varchar(255) default '', `simulation_state` varbinary(255) default '',
`causality_state` varchar(255) default '', `causality_state` varbinary(255) default '',
`invoice_state` varchar(255) default '', `invoice_state` varbinary(255) default '',
`payment_state` varchar(255) default '', `payment_state` varbinary(255) default '',
`event_state` varchar(255) default '', `event_state` varbinary(255) default '',
`immobilisation_state` varchar(255) default '', `immobilisation_state` varbinary(255) default '',
`reference` varchar(255) binary default '', `reference` varbinary(255) default '',
`grouping_reference` varchar(255) default '', `grouping_reference` varbinary(255) default '',
`grouping_date` datetime, `grouping_date` datetime,
`source_reference` varchar(255) default '', `source_reference` varbinary(255) default '',
`destination_reference` varchar(255) default '', `destination_reference` varbinary(255) default '',
`string_index` varchar(255), `string_index` varchar(255),
`int_index` INT, `int_index` INT,
`float_index` real, `float_index` real,
...@@ -37,7 +37,7 @@ CREATE TABLE `catalog` ( ...@@ -37,7 +37,7 @@ CREATE TABLE `catalog` (
`creation_date` datetime, `creation_date` datetime,
`modification_date` datetime, `modification_date` datetime,
`indexation_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `indexation_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `security_uid` (`security_uid`), KEY `security_uid` (`security_uid`),
KEY `owner` (`owner`), KEY `owner` (`owner`),
KEY `viewable_owner` (`viewable_owner`), KEY `viewable_owner` (`viewable_owner`),
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
# #
CREATE TABLE `category` ( CREATE TABLE `category` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`category_uid` BIGINT UNSIGNED default '0', `category_uid` BIGINT UNSIGNED NOT NULL,
`base_category_uid` BIGINT UNSIGNED default '0', `base_category_uid` BIGINT UNSIGNED NOT NULL,
`category_strict_membership` tinyint(1) default '0', `category_strict_membership` tinyint(1) NOT NULL,
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=InnoDB;
\ No newline at end of file
...@@ -11,7 +11,7 @@ CREATE TABLE `item` ( ...@@ -11,7 +11,7 @@ CREATE TABLE `item` (
`resource_uid` BIGINT UNSIGNED default '0', `resource_uid` BIGINT UNSIGNED default '0',
`aggregate_uid` BIGINT UNSIGNED default '0', `aggregate_uid` BIGINT UNSIGNED default '0',
`variation_text` VARCHAR(255), `variation_text` VARCHAR(255),
`simulation_state` VARCHAR(255) default '', `simulation_state` varbinary(255) default '',
PRIMARY KEY (`uid`, `aggregate_uid`,`order_id`), PRIMARY KEY (`uid`, `aggregate_uid`,`order_id`),
KEY `section_uid` (`section_uid`), KEY `section_uid` (`section_uid`),
KEY `resource_uid` (`resource_uid`), KEY `resource_uid` (`resource_uid`),
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
CREATE TABLE `record` ( CREATE TABLE `record` (
`uid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `uid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`path` varchar(255) NOT NULL default '', `path` varbinary(255) NOT NULL default '',
`catalog` BOOL NOT NULL default 0, `catalog` BOOL NOT NULL default 0,
`played` BOOL NOT NULL default 0, `played` BOOL NOT NULL default 0,
`date` DATETIME NOT NULL, `date` DATETIME NOT NULL,
......
CREATE TABLE roles_and_users ( CREATE TABLE roles_and_users (
uid INT UNSIGNED, uid INT UNSIGNED,
allowedRolesAndUsers VARCHAR(255), allowedRolesAndUsers varbinary(255) NOT NULL,
KEY `uid` (`uid`), KEY `uid` (`uid`),
KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`) KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
...@@ -5,26 +5,26 @@ ...@@ -5,26 +5,26 @@
CREATE TABLE `stock` ( CREATE TABLE `stock` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`order_id` BIGINT UNSIGNED NOT NULL, `order_id` BIGINT UNSIGNED NOT NULL,
`explanation_uid` BIGINT UNSIGNED, `explanation_uid` BIGINT UNSIGNED NOT NULL default '0',
`node_uid` BIGINT UNSIGNED, `node_uid` BIGINT UNSIGNED NOT NULL default '0',
`section_uid` BIGINT UNSIGNED, `section_uid` BIGINT UNSIGNED NOT NULL default '0',
`payment_uid` BIGINT UNSIGNED, `payment_uid` BIGINT UNSIGNED NOT NULL default '0',
`function_uid` BIGINT UNSIGNED, `function_uid` BIGINT UNSIGNED NOT NULL default '0',
`project_uid` BIGINT UNSIGNED, `project_uid` BIGINT UNSIGNED NOT NULL default '0',
`funding_uid` BIGINT UNSIGNED, `funding_uid` BIGINT UNSIGNED NOT NULL default '0',
`ledger_uid` BIGINT UNSIGNED, `ledger_uid` BIGINT UNSIGNED NOT NULL default '0',
`payment_request_uid` BIGINT UNSIGNED, `payment_request_uid` BIGINT UNSIGNED NOT NULL default '0',
`mirror_section_uid` BIGINT UNSIGNED, `mirror_section_uid` BIGINT UNSIGNED NOT NULL default '0',
`mirror_node_uid` BIGINT UNSIGNED, `mirror_node_uid` BIGINT UNSIGNED NOT NULL default '0',
`resource_uid` BIGINT UNSIGNED, `resource_uid` BIGINT UNSIGNED NOT NULL default '0',
`quantity` real, `quantity` real NOT NULL default 0,
`is_cancellation` BOOLEAN, `is_cancellation` BOOLEAN NOT NULL default '0',
`is_accountable` BOOLEAN, `is_accountable` BOOLEAN NOT NULL default '0',
`date` datetime, `date` datetime,
`mirror_date` datetime, `mirror_date` datetime,
`total_price` real , `total_price` real NOT NULL default 0,
`portal_type` VARCHAR(255), `portal_type` varbinary(255) NOT NULL,
`simulation_state` varchar(255) default '', `simulation_state` varbinary(255) NOT NULL default '',
`variation_text` VARCHAR(255), `variation_text` VARCHAR(255),
`sub_variation_text` VARCHAR(255), `sub_variation_text` VARCHAR(255),
PRIMARY KEY (`uid`, `order_id`), PRIMARY KEY (`uid`, `order_id`),
......
CREATE TABLE translation ( CREATE TABLE translation (
language VARCHAR(255), language varbinary(255),
message_context VARCHAR(50), message_context varbinary(50),
portal_type VARCHAR(255), portal_type varbinary(255),
original_message VARCHAR(255), original_message VARCHAR(255),
translated_message VARCHAR(255), translated_message VARCHAR(255),
KEY `message` (`translated_message`), KEY `message` (`translated_message`),
......
CREATE TABLE `user` ( CREATE TABLE `user` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`user_id` varchar(255) binary default '', `user_id` varbinary(255) NOT NULL default '',
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `user_id` (`user_id`) KEY `user_id` (`user_id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
CREATE TABLE `versioning` ( CREATE TABLE `versioning` (
`uid` BIGINT UNSIGNED NOT NULL, `uid` BIGINT UNSIGNED NOT NULL,
`version` varchar(10) default '', `version` varchar(10) NOT NULL default '',
`language` varchar(5) default '', `language` varchar(5) NOT NULL default '',
`revision` varchar(10) default '', `revision` varchar(10) NOT NULL default '',
`subject_set_uid` INT UNSIGNED, `subject_set_uid` INT UNSIGNED,
`effective_date` datetime default NULL, `effective_date` datetime default NULL,
`expiration_date` datetime default NULL, `expiration_date` datetime default NULL,
......
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