castopod/app/Database/Migrations/2020-06-08-210000_add_analytics_unknown_useragents.php
Yassine Doghri a1a28de702 refactor: rewrite form pages using form helper
- 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
2020-10-15 14:41:32 +00:00

53 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Class AddAnalyticsUnknownUseragents
* Creates analytics_unknown_useragents 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 AddAnalyticsUnknownUseragents extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'auto_increment' => true,
],
'useragent' => [
'type' => 'VARCHAR',
'constraint' => 191,
'unique' => true,
],
'hits' => [
'type' => 'INT',
'constraint' => 10,
'default' => 1,
],
]);
$this->forge->addKey('id', true);
// `created_at` and `updated_at` are created with SQL because Model class wont be used for insertion (Stored Procedure will be used instead)
$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->createTable('analytics_unknown_useragents');
}
public function down()
{
$this->forge->dropTable('analytics_unknown_useragents');
}
}