This commit is contained in:
@@ -1,2 +1,15 @@
|
||||
ALTER TABLE traffic_log ADD INDEX IF NOT EXISTS idx_timestamp (timestamp);
|
||||
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;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE IF NOT EXISTS `application_versions` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`platform` varchar(50) NOT NULL COMMENT 'Platform',
|
||||
`version` varchar(50) NOT NULL COMMENT 'Version Number',
|
||||
`min_version` varchar(50) DEFAULT NULL COMMENT 'Minimum Force Update Version',
|
||||
`force_update` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Force Update',
|
||||
`url` varchar(255) NOT NULL COMMENT 'Download URL',
|
||||
`description` json DEFAULT NULL COMMENT 'Update Description',
|
||||
`is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Default Version',
|
||||
`is_in_review` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is In Review',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||
`deleted_at` datetime(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_application_versions_deleted_at` (`deleted_at`),
|
||||
KEY `idx_platform` (`platform`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Application Version Management';
|
||||
|
||||
Reference in New Issue
Block a user