Skip to content
Snippets Groups Projects
Commit 9660aa97 authored by Benjamin Bellamy's avatar Benjamin Bellamy :speech_balloon: Committed by Yassine Doghri
Browse files

fix: reorder fields as composite primary keys for analytics tables

parent ed69b2f5
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ class AddAnalyticsPodcastsByEpisode extends Migration ...@@ -41,7 +41,7 @@ class AddAnalyticsPodcastsByEpisode extends Migration
'default' => 1, 'default' => 1,
], ],
]); ]);
$this->forge->addPrimaryKey(['podcast_id', 'episode_id', 'date']); $this->forge->addPrimaryKey(['podcast_id', 'date', 'episode_id']);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
); );
......
...@@ -50,11 +50,11 @@ class AddAnalyticsPodcastsByPlayer extends Migration ...@@ -50,11 +50,11 @@ class AddAnalyticsPodcastsByPlayer extends Migration
]); ]);
$this->forge->addPrimaryKey([ $this->forge->addPrimaryKey([
'podcast_id', 'podcast_id',
'date',
'app', 'app',
'device', 'device',
'os', 'os',
'bot', 'bot',
'date',
]); ]);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
......
...@@ -36,7 +36,7 @@ class AddAnalyticsPodcastsByCountry extends Migration ...@@ -36,7 +36,7 @@ class AddAnalyticsPodcastsByCountry extends Migration
'default' => 1, 'default' => 1,
], ],
]); ]);
$this->forge->addPrimaryKey(['podcast_id', 'country_code', 'date']); $this->forge->addPrimaryKey(['podcast_id', 'date', 'country_code']);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
); );
......
...@@ -51,9 +51,9 @@ class AddAnalyticsPodcastsByRegion extends Migration ...@@ -51,9 +51,9 @@ class AddAnalyticsPodcastsByRegion extends Migration
]); ]);
$this->forge->addPrimaryKey([ $this->forge->addPrimaryKey([
'podcast_id', 'podcast_id',
'date',
'country_code', 'country_code',
'region_code', 'region_code',
'date',
]); ]);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
......
...@@ -36,7 +36,7 @@ class AddAnalyticsWebsiteByBrowser extends Migration ...@@ -36,7 +36,7 @@ class AddAnalyticsWebsiteByBrowser extends Migration
'default' => 1, 'default' => 1,
], ],
]); ]);
$this->forge->addPrimaryKey(['podcast_id', 'browser', 'date']); $this->forge->addPrimaryKey(['podcast_id', 'date', 'browser']);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
); );
......
...@@ -46,7 +46,7 @@ class AddAnalyticsWebsiteByReferer extends Migration ...@@ -46,7 +46,7 @@ class AddAnalyticsWebsiteByReferer extends Migration
'default' => 1, 'default' => 1,
], ],
]); ]);
$this->forge->addPrimaryKey(['podcast_id', 'referer', 'date']); $this->forge->addPrimaryKey(['podcast_id', 'date', 'referer']);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
); );
......
...@@ -36,7 +36,7 @@ class AddAnalyticsWebsiteByEntryPage extends Migration ...@@ -36,7 +36,7 @@ class AddAnalyticsWebsiteByEntryPage extends Migration
'default' => 1, 'default' => 1,
], ],
]); ]);
$this->forge->addPrimaryKey(['podcast_id', 'entry_page', 'date']); $this->forge->addPrimaryKey(['podcast_id', 'date', 'entry_page']);
$this->forge->addField( $this->forge->addField(
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()' '`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment