schema/mysql: object counters for generated files

This commit is contained in:
Thomas Gelf 2015-12-15 16:41:07 +01:00
parent 0c68677fa5
commit d1d9ebe412
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,13 @@
ALTER TABLE director_generated_file
ADD COLUMN cnt_object INT(10) UNSIGNED NOT NULL DEFAULT 0,
ADD COLUMN cnt_template INT(10) UNSIGNED NOT NULL DEFAULT 0;
UPDATE director_generated_file
SET cnt_object = ROUND(
(LENGTH(content) - LENGTH( REPLACE(content, 'object ', '') ) )
/ LENGTH('object ')
), cnt_template = ROUND(
(LENGTH(content) - LENGTH( REPLACE(content, 'template ', '') ) )
/ LENGTH('template ')
);

View File

@ -52,6 +52,8 @@ CREATE TABLE director_generated_config (
CREATE TABLE director_generated_file (
checksum VARBINARY(20) NOT NULL COMMENT 'SHA1(content)',
content MEDIUMTEXT NOT NULL,
cnt_object INT(10) UNSIGNED NOT NULL DEFAULT 0,
cnt_template INT(10) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (checksum)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;