Refine web UI and usage docs
This commit is contained in:
@@ -2,24 +2,7 @@ CREATE DATABASE IF NOT EXISTS `mobilemodels`
|
||||
DEFAULT CHARACTER SET utf8mb4
|
||||
DEFAULT COLLATE utf8mb4_0900_ai_ci;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS `python_services_test`
|
||||
DEFAULT CHARACTER SET utf8mb4
|
||||
DEFAULT COLLATE utf8mb4_0900_ai_ci;
|
||||
|
||||
SET @drop_stmt = (
|
||||
SELECT CASE `TABLE_TYPE`
|
||||
WHEN 'BASE TABLE' THEN 'DROP TABLE `python_services_test`.`models`'
|
||||
WHEN 'VIEW' THEN 'DROP VIEW `python_services_test`.`models`'
|
||||
ELSE 'DO 0'
|
||||
END
|
||||
FROM `information_schema`.`TABLES`
|
||||
WHERE `TABLE_SCHEMA` = 'python_services_test' AND `TABLE_NAME` = 'models'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @drop_stmt = COALESCE(@drop_stmt, 'DO 0');
|
||||
PREPARE stmt FROM @drop_stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP DATABASE IF EXISTS `python_services_test`;
|
||||
|
||||
USE `mobilemodels`;
|
||||
|
||||
@@ -55,12 +38,12 @@ DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @drop_stmt = (
|
||||
SELECT CASE `TABLE_TYPE`
|
||||
WHEN 'BASE TABLE' THEN 'DROP TABLE `mm_device_record`'
|
||||
WHEN 'VIEW' THEN 'DROP VIEW `mm_device_record`'
|
||||
WHEN 'BASE TABLE' THEN 'DROP TABLE `mm_device_lookup`'
|
||||
WHEN 'VIEW' THEN 'DROP VIEW `mm_device_lookup`'
|
||||
ELSE 'DO 0'
|
||||
END
|
||||
FROM `information_schema`.`TABLES`
|
||||
WHERE `TABLE_SCHEMA` = 'mobilemodels' AND `TABLE_NAME` = 'mm_device_record'
|
||||
WHERE `TABLE_SCHEMA` = 'mobilemodels' AND `TABLE_NAME` = 'mm_device_lookup'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @drop_stmt = COALESCE(@drop_stmt, 'DO 0');
|
||||
@@ -70,12 +53,12 @@ DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @drop_stmt = (
|
||||
SELECT CASE `TABLE_TYPE`
|
||||
WHEN 'BASE TABLE' THEN 'DROP TABLE `mm_device_lookup`'
|
||||
WHEN 'VIEW' THEN 'DROP VIEW `mm_device_lookup`'
|
||||
WHEN 'BASE TABLE' THEN 'DROP TABLE `mm_device_record`'
|
||||
WHEN 'VIEW' THEN 'DROP VIEW `mm_device_record`'
|
||||
ELSE 'DO 0'
|
||||
END
|
||||
FROM `information_schema`.`TABLES`
|
||||
WHERE `TABLE_SCHEMA` = 'mobilemodels' AND `TABLE_NAME` = 'mm_device_lookup'
|
||||
WHERE `TABLE_SCHEMA` = 'mobilemodels' AND `TABLE_NAME` = 'mm_device_record'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @drop_stmt = COALESCE(@drop_stmt, 'DO 0');
|
||||
@@ -177,111 +160,3 @@ CREATE TABLE IF NOT EXISTS `mm_brand_lookup` (
|
||||
KEY `idx_mm_brand_lookup_parent_brand` (`parent_brand`),
|
||||
KEY `idx_mm_brand_lookup_market_brand` (`market_brand`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
CREATE OR REPLACE VIEW `mm_device_lookup` AS
|
||||
SELECT
|
||||
c.`alias_norm`,
|
||||
c.`record_id`,
|
||||
c.`device_name`,
|
||||
c.`brand`,
|
||||
c.`manufacturer_brand`,
|
||||
c.`parent_brand`,
|
||||
c.`market_brand`,
|
||||
c.`device_type`,
|
||||
c.`source_file`,
|
||||
c.`section`,
|
||||
c.`source_rank`,
|
||||
c.`source_weight`,
|
||||
c.`updated_at`
|
||||
FROM `mm_device_catalog` AS c;
|
||||
|
||||
CREATE OR REPLACE VIEW `mm_device_record` AS
|
||||
SELECT
|
||||
c.`record_id`,
|
||||
c.`device_name`,
|
||||
c.`brand`,
|
||||
c.`manufacturer_brand`,
|
||||
c.`parent_brand`,
|
||||
c.`market_brand`,
|
||||
c.`device_type`,
|
||||
c.`source_file`,
|
||||
c.`section`,
|
||||
c.`source_rank`,
|
||||
c.`source_weight`,
|
||||
CAST(CONCAT('[', GROUP_CONCAT(JSON_QUOTE(c.`model`) ORDER BY c.`model` SEPARATOR ','), ']') AS JSON) AS `aliases_json`,
|
||||
MAX(c.`updated_at`) AS `updated_at`
|
||||
FROM `mm_device_catalog` AS c
|
||||
GROUP BY
|
||||
c.`record_id`,
|
||||
c.`device_name`,
|
||||
c.`brand`,
|
||||
c.`manufacturer_brand`,
|
||||
c.`parent_brand`,
|
||||
c.`market_brand`,
|
||||
c.`device_type`,
|
||||
c.`source_file`,
|
||||
c.`section`,
|
||||
c.`source_rank`,
|
||||
c.`source_weight`;
|
||||
|
||||
CREATE OR REPLACE VIEW `vw_mm_device_lookup` AS
|
||||
SELECT
|
||||
c.`alias_norm`,
|
||||
c.`record_id`,
|
||||
c.`device_name`,
|
||||
c.`brand`,
|
||||
c.`manufacturer_brand`,
|
||||
c.`parent_brand`,
|
||||
c.`market_brand`,
|
||||
c.`device_type`,
|
||||
c.`source_file`,
|
||||
c.`section`,
|
||||
c.`source_rank`,
|
||||
c.`source_weight`,
|
||||
c.`updated_at`
|
||||
FROM `mm_device_catalog` AS c;
|
||||
|
||||
CREATE OR REPLACE VIEW `models` AS
|
||||
SELECT
|
||||
c.`model`,
|
||||
c.`device_type` AS `dtype`,
|
||||
c.`market_brand` AS `brand`,
|
||||
c.`manufacturer_brand` AS `brand_title`,
|
||||
c.`code`,
|
||||
c.`code_alias`,
|
||||
c.`device_name` AS `model_name`,
|
||||
c.`ver_name`,
|
||||
c.`updated_at` AS `update_at`,
|
||||
c.`hash_md5`,
|
||||
c.`hash_crc`
|
||||
FROM `mm_device_catalog` AS c;
|
||||
|
||||
CREATE OR REPLACE VIEW `vw_models` AS
|
||||
SELECT
|
||||
c.`model`,
|
||||
c.`device_type` AS `dtype`,
|
||||
c.`market_brand` AS `brand`,
|
||||
c.`manufacturer_brand` AS `brand_title`,
|
||||
c.`code`,
|
||||
c.`code_alias`,
|
||||
c.`device_name` AS `model_name`,
|
||||
c.`ver_name`,
|
||||
c.`updated_at` AS `update_at`,
|
||||
c.`hash_md5`,
|
||||
c.`hash_crc`
|
||||
FROM `mm_device_catalog` AS c;
|
||||
|
||||
CREATE OR REPLACE VIEW `python_services_test`.`models` AS
|
||||
SELECT
|
||||
`model`,
|
||||
`dtype`,
|
||||
`brand`,
|
||||
`brand_title`,
|
||||
`code`,
|
||||
`code_alias`,
|
||||
`model_name`,
|
||||
`ver_name`,
|
||||
`update_at`,
|
||||
`hash_md5`,
|
||||
`hash_crc`
|
||||
FROM `mobilemodels`.`models`;
|
||||
|
||||
Reference in New Issue
Block a user