/* UGC server: ugc.brick_count and ugc.triangle_count are what it counted when it made a model (the bricks, and the triangles of the made mesh's most detailed level; 0 until it has), so the dashboard can sort models by size. */ SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE ugc ADD COLUMN brick_count INT UNSIGNED NOT NULL DEFAULT 0', 'DO 0') FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'ugc' AND column_name = 'brick_count'); PREPARE dlu_column_stmt FROM @dlu_column; EXECUTE dlu_column_stmt; DEALLOCATE PREPARE dlu_column_stmt; SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE ugc ADD COLUMN triangle_count INT UNSIGNED NOT NULL DEFAULT 0', 'DO 0') FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'ugc' AND column_name = 'triangle_count'); PREPARE dlu_column_stmt FROM @dlu_column; EXECUTE dlu_column_stmt; DEALLOCATE PREPARE dlu_column_stmt;