summaryrefslogtreecommitdiffstats
path: root/schema/mysql-legacy-changes/upgrade_56.sql
blob: 75683de6b66c2aeb7a80beff071357acd79cb225 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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 ')
);