Unverified Commit 714d6b5d authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(analytics): update migrations to set decimal precision for latitude and longitude

add unsigned for soundbites start time and duration
parent 63f49c71
Pipeline #932 passed with stages
in 10 minutes and 7 seconds
......@@ -34,10 +34,12 @@ class AddSoundbites extends Migration
],
'start_time' => [
'type' => 'DECIMAL(8,3)',
'unsigned' => true,
],
'duration' => [
// soundbite duration cannot be higher than 9999,999 seconds ~ 2.77 hours
'type' => 'DECIMAL(7,3)',
'unsigned' => true,
],
'label' => [
'type' => 'VARCHAR',
......
......@@ -37,11 +37,11 @@ class AddAnalyticsPodcastsByRegion extends Migration
'comment' => 'ISO 3166-2 code.',
],
'latitude' => [
'type' => 'DECIMAL',
'type' => 'DECIMAL(8,6)',
'null' => true,
],
'longitude' => [
'type' => 'DECIMAL',
'type' => 'DECIMAL(9,6)',
'null' => true,
],
'hits' => [
......
......@@ -26,14 +26,14 @@ class AddAnalyticsPodcastsProcedure extends Migration
CREATE PROCEDURE `{$prefix}analytics_podcasts` (
IN `p_podcast_id` INT UNSIGNED,
IN `p_episode_id` INT UNSIGNED,
IN `p_country_code` VARCHAR(3) CHARSET utf8mb4,
IN `p_region_code` VARCHAR(3) CHARSET utf8mb4,
IN `p_latitude` DECIMAL,
IN `p_longitude` DECIMAL,
IN `p_service` VARCHAR(128) CHARSET utf8mb4,
IN `p_app` VARCHAR(128) CHARSET utf8mb4,
IN `p_device` VARCHAR(32) CHARSET utf8mb4,
IN `p_os` VARCHAR(32) CHARSET utf8mb4,
IN `p_country_code` VARCHAR(3),
IN `p_region_code` VARCHAR(3),
IN `p_latitude` DECIMAL(8,6),
IN `p_longitude` DECIMAL(9,6),
IN `p_service` VARCHAR(128),
IN `p_app` VARCHAR(128),
IN `p_device` VARCHAR(32),
IN `p_os` VARCHAR(32),
IN `p_bot` TINYINT(1) UNSIGNED,
IN `p_filesize` INT UNSIGNED,
IN `p_duration` INT UNSIGNED,
......
......@@ -22,7 +22,7 @@ class AddAnalyticsUnknownUseragentsProcedure extends Migration
// Example: CALL analytics_unknown_useragents('Podcasts/1430.46 CFNetwork/1125.2 Darwin/19.4.0');
$procedureName = $this->db->prefixTable('analytics_unknown_useragents');
$createQuery = <<<CODE_SAMPLE
CREATE PROCEDURE `{$procedureName}` (IN `p_useragent` VARCHAR(191) CHARSET utf8mb4) MODIFIES SQL DATA
CREATE PROCEDURE `{$procedureName}` (IN `p_useragent` VARCHAR(191)) MODIFIES SQL DATA
DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Add an unknown useragent to table {$procedureName}.'
......
......@@ -22,10 +22,17 @@ class AddAnalyticsWebsiteProcedure extends Migration
// Example: CALL analytics_website(1,'FR','Firefox');
$procedureName = $this->db->prefixTable('analytics_website');
$createQuery = <<<CODE_SAMPLE
CREATE PROCEDURE `{$procedureName}` (IN `p_podcast_id` INT UNSIGNED, IN `p_browser` VARCHAR(191) CHARSET utf8mb4, IN `p_entry_page` VARCHAR(512) CHARSET utf8mb4, IN `p_referer_url` VARCHAR(512) CHARSET utf8mb4, IN `p_domain` VARCHAR(128) CHARSET utf8mb4, IN `p_keywords` VARCHAR(384) CHARSET utf8mb4) MODIFIES SQL DATA
CREATE PROCEDURE `{$procedureName}` (
IN `p_podcast_id` INT UNSIGNED,
IN `p_browser` VARCHAR(191),
IN `p_entry_page` VARCHAR(512),
IN `p_referer_url` VARCHAR(512),
IN `p_domain` VARCHAR(128),
IN `p_keywords` VARCHAR(384)
) COMMENT 'Add one hit in website logs tables.'
MODIFIES SQL DATA
DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Add one hit in website logs tables.'
BEGIN
SET @current_date = DATE(NOW());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment