Some checks failed
Build docker and publish / build (20.15.1) (push) Has been cancelled
16 lines
406 B
SQL
16 lines
406 B
SQL
SET @index_exists = (
|
|
SELECT COUNT(1)
|
|
FROM information_schema.STATISTICS
|
|
WHERE TABLE_SCHEMA = DATABASE()
|
|
AND TABLE_NAME = 'traffic_log'
|
|
AND INDEX_NAME = 'idx_timestamp'
|
|
);
|
|
|
|
SET @sql = IF(@index_exists = 0,
|
|
'CREATE INDEX idx_timestamp ON traffic_log (timestamp)',
|
|
'SELECT ''Index already exists'' AS message');
|
|
|
|
PREPARE stmt FROM @sql;
|
|
EXECUTE stmt;
|
|
DEALLOCATE PREPARE stmt;
|