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 (
uid INT UNSIGNED,
local_roles_group_id VARCHAR(255) default '',
allowedRolesAndUsers VARCHAR(255),
local_roles_group_id varbinary(255) NOT NULL default '',
allowedRolesAndUsers varbinary(255) NOT NULL,
KEY `uid` (`uid`),
KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`),
KEY `local_roles_group_id` (`local_roles_group_id`)
......
......@@ -5,5 +5,6 @@
CREATE TABLE `alarm` (
`uid` BIGINT UNSIGNED NOT NULL,
`alarm_date` DATETIME,
PRIMARY KEY (`uid`)
PRIMARY KEY (`uid`),
KEY `alarm_date` (`alarm_date`)
) ENGINE=InnoDB;
......@@ -5,31 +5,31 @@
CREATE TABLE `catalog` (
`uid` BIGINT UNSIGNED NOT NULL,
`security_uid` INT UNSIGNED,
`owner` varbinary(255) NOT NULL default '',
`viewable_owner` varbinary(255) NOT NULL default '',
`path` varchar(255) NOT NULL default '',
`relative_url` varchar(255) NOT NULL default '',
`parent_uid` BIGINT UNSIGNED default '0',
`id` varchar(255) default '',
`owner` varbinary(255) default '',
`viewable_owner` varbinary(255) default '',
`path` varbinary(255) NOT NULL default '',
`relative_url` varbinary(255) NOT NULL default '',
`parent_uid` BIGINT UNSIGNED default 0,
`id` varbinary(255) NOT NULL default '',
`description` text,
`title` varchar(255) default '',
`meta_type` varchar(255) default '',
`portal_type` varchar(255) default '',
`opportunity_state` varchar(255) default '',
`meta_type` varbinary(255) default '',
`portal_type` varbinary(255) NOT NULL default '',
`opportunity_state` varbinary(255) default '',
`corporate_registration_code` varchar(255),
`ean13_code` varchar(255),
`validation_state` varchar(255) default '',
`simulation_state` varchar(255) default '',
`causality_state` varchar(255) default '',
`invoice_state` varchar(255) default '',
`payment_state` varchar(255) default '',
`event_state` varchar(255) default '',
`immobilisation_state` varchar(255) default '',
`reference` varchar(255) binary default '',
`grouping_reference` varchar(255) default '',
`validation_state` varbinary(255) default '',
`simulation_state` varbinary(255) default '',
`causality_state` varbinary(255) default '',
`invoice_state` varbinary(255) default '',
`payment_state` varbinary(255) default '',
`event_state` varbinary(255) default '',
`immobilisation_state` varbinary(255) default '',
`reference` varbinary(255) default '',
`grouping_reference` varbinary(255) default '',
`grouping_date` datetime,
`source_reference` varchar(255) default '',
`destination_reference` varchar(255) default '',
`source_reference` varbinary(255) default '',
`destination_reference` varbinary(255) default '',
`string_index` varchar(255),
`int_index` INT,
`float_index` real,
......@@ -37,7 +37,7 @@ CREATE TABLE `catalog` (
`creation_date` datetime,
`modification_date` datetime,
`indexation_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uid`),
PRIMARY KEY (`uid`),
KEY `security_uid` (`security_uid`),
KEY `owner` (`owner`),
KEY `viewable_owner` (`viewable_owner`),
......
......@@ -4,9 +4,9 @@
#
CREATE TABLE `category` (
`uid` BIGINT UNSIGNED NOT NULL,
`category_uid` BIGINT UNSIGNED default '0',
`base_category_uid` BIGINT UNSIGNED default '0',
`category_strict_membership` tinyint(1) default '0',
`category_uid` BIGINT UNSIGNED NOT NULL,
`base_category_uid` BIGINT UNSIGNED NOT NULL,
`category_strict_membership` tinyint(1) NOT NULL,
PRIMARY KEY (`uid`, `category_uid`, `base_category_uid`, `category_strict_membership`),
KEY `Membership` (`category_uid`,`base_category_uid`)
) ENGINE=InnoDB;
\ No newline at end of file
KEY `Membership` (`category_uid`, `base_category_uid`)
) ENGINE=InnoDB;
......@@ -11,7 +11,7 @@ CREATE TABLE `item` (
`resource_uid` BIGINT UNSIGNED default '0',
`aggregate_uid` BIGINT UNSIGNED default '0',
`variation_text` VARCHAR(255),
`simulation_state` VARCHAR(255) default '',
`simulation_state` varbinary(255) default '',
PRIMARY KEY (`uid`, `aggregate_uid`,`order_id`),
KEY `section_uid` (`section_uid`),
KEY `resource_uid` (`resource_uid`),
......
......@@ -4,7 +4,7 @@
#
CREATE TABLE `record` (
`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,
`played` BOOL NOT NULL default 0,
`date` DATETIME NOT NULL,
......
CREATE TABLE roles_and_users (
uid INT UNSIGNED,
allowedRolesAndUsers VARCHAR(255),
allowedRolesAndUsers varbinary(255) NOT NULL,
KEY `uid` (`uid`),
KEY `allowedRolesAndUsers` (`allowedRolesAndUsers`)
) ENGINE=InnoDB;
......@@ -5,26 +5,26 @@
CREATE TABLE `stock` (
`uid` BIGINT UNSIGNED NOT NULL,
`order_id` BIGINT UNSIGNED NOT NULL,
`explanation_uid` BIGINT UNSIGNED,
`node_uid` BIGINT UNSIGNED,
`section_uid` BIGINT UNSIGNED,
`payment_uid` BIGINT UNSIGNED,
`function_uid` BIGINT UNSIGNED,
`project_uid` BIGINT UNSIGNED,
`funding_uid` BIGINT UNSIGNED,
`ledger_uid` BIGINT UNSIGNED,
`payment_request_uid` BIGINT UNSIGNED,
`mirror_section_uid` BIGINT UNSIGNED,
`mirror_node_uid` BIGINT UNSIGNED,
`resource_uid` BIGINT UNSIGNED,
`quantity` real,
`is_cancellation` BOOLEAN,
`is_accountable` BOOLEAN,
`explanation_uid` BIGINT UNSIGNED NOT NULL default '0',
`node_uid` BIGINT UNSIGNED NOT NULL default '0',
`section_uid` BIGINT UNSIGNED NOT NULL default '0',
`payment_uid` BIGINT UNSIGNED NOT NULL default '0',
`function_uid` BIGINT UNSIGNED NOT NULL default '0',
`project_uid` BIGINT UNSIGNED NOT NULL default '0',
`funding_uid` BIGINT UNSIGNED NOT NULL default '0',
`ledger_uid` BIGINT UNSIGNED NOT NULL default '0',
`payment_request_uid` BIGINT UNSIGNED NOT NULL default '0',
`mirror_section_uid` BIGINT UNSIGNED NOT NULL default '0',
`mirror_node_uid` BIGINT UNSIGNED NOT NULL default '0',
`resource_uid` BIGINT UNSIGNED NOT NULL default '0',
`quantity` real NOT NULL default 0,
`is_cancellation` BOOLEAN NOT NULL default '0',
`is_accountable` BOOLEAN NOT NULL default '0',
`date` datetime,
`mirror_date` datetime,
`total_price` real ,
`portal_type` VARCHAR(255),
`simulation_state` varchar(255) default '',
`total_price` real NOT NULL default 0,
`portal_type` varbinary(255) NOT NULL,
`simulation_state` varbinary(255) NOT NULL default '',
`variation_text` VARCHAR(255),
`sub_variation_text` VARCHAR(255),
PRIMARY KEY (`uid`, `order_id`),
......
CREATE TABLE translation (
language VARCHAR(255),
message_context VARCHAR(50),
portal_type VARCHAR(255),
language varbinary(255),
message_context varbinary(50),
portal_type varbinary(255),
original_message VARCHAR(255),
translated_message VARCHAR(255),
KEY `message` (`translated_message`),
......
CREATE TABLE `user` (
`uid` BIGINT UNSIGNED NOT NULL,
`user_id` varchar(255) binary default '',
`user_id` varbinary(255) NOT NULL default '',
PRIMARY KEY (`uid`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB;
CREATE TABLE `versioning` (
`uid` BIGINT UNSIGNED NOT NULL,
`version` varchar(10) default '',
`language` varchar(5) default '',
`revision` varchar(10) default '',
`version` varchar(10) NOT NULL default '',
`language` varchar(5) NOT NULL default '',
`revision` varchar(10) NOT NULL default '',
`subject_set_uid` INT UNSIGNED,
`effective_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