mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-11 08:45:45 +00:00

This removes computing latency when retrieving episodes list with download count in admin. The more analytics records, the more it took to calculate the sum of hits to get the downloads count for each episode.
30 lines
609 B
PHP
30 lines
609 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class AddEpisodeDownloadsCount extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$fields = [
|
|
'downloads_count' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'default' => 0,
|
|
'after' => 'is_published_on_hubs',
|
|
],
|
|
];
|
|
|
|
$this->forge->addColumn('episodes', $fields);
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->forge->dropColumn('episodes', 'downloads_count');
|
|
}
|
|
}
|