mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-10 12:39:38 +02:00
- add installGateway to app config - update route names and groups - remove `author_name` and `author_email` from `episodes` table - remove `author_name` and `author_email` from `podcasts` table - remove `owner_id` + add `created_by` and `updated_by` fields in `podcasts` and `episodes` tables - remove unnecessary comments in database fields - remove confirm password inputs from auth forms for better ux - rename `pub_date` field to `published_at` and add publication time field in episode form closes #14, #28
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class AddAnalyticsPodcastsByCountry
|
|
* Creates analytics_podcasts_by_country table in database
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class AddAnalyticsPodcastsByCountry extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'BIGINT',
|
|
'constraint' => 20,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'podcast_id' => [
|
|
'type' => 'BIGINT',
|
|
'constraint' => 20,
|
|
'unsigned' => true,
|
|
],
|
|
'country_code' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 3,
|
|
'comment' => 'ISO 3166-1 code.',
|
|
],
|
|
'date' => [
|
|
'type' => 'date',
|
|
],
|
|
'hits' => [
|
|
'type' => 'INT',
|
|
'constraint' => 10,
|
|
'default' => 1,
|
|
],
|
|
]);
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addUniqueKey(['podcast_id', 'country_code', 'date']);
|
|
$this->forge->addField(
|
|
'`created_at` timestamp NOT NULL DEFAULT current_timestamp()'
|
|
);
|
|
$this->forge->addField(
|
|
'`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()'
|
|
);
|
|
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id');
|
|
$this->forge->createTable('analytics_podcasts_by_country');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('analytics_podcasts_by_country');
|
|
}
|
|
}
|