2020-06-08 20:32:42 +00:00
|
|
|
<?php
|
2020-08-04 11:25:22 +00:00
|
|
|
|
2020-06-10 15:00:12 +00:00
|
|
|
/**
|
|
|
|
* Class AddEpisodes
|
|
|
|
* Creates episodes table in database
|
|
|
|
*
|
|
|
|
* @copyright 2020 Podlibre
|
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
2020-06-08 20:32:42 +00:00
|
|
|
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
|
|
|
|
class AddEpisodes extends Migration
|
|
|
|
{
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
$this->forge->addField([
|
|
|
|
'id' => [
|
2020-10-29 15:45:19 +00:00
|
|
|
'type' => 'INT',
|
2020-06-08 20:32:42 +00:00
|
|
|
'unsigned' => true,
|
|
|
|
'auto_increment' => true,
|
|
|
|
],
|
|
|
|
'podcast_id' => [
|
2020-10-29 15:45:19 +00:00
|
|
|
'type' => 'INT',
|
2020-06-08 20:32:42 +00:00
|
|
|
'unsigned' => true,
|
|
|
|
],
|
2020-08-21 08:41:09 +00:00
|
|
|
'guid' => [
|
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 255,
|
2020-08-21 08:41:09 +00:00
|
|
|
],
|
2020-06-08 20:32:42 +00:00
|
|
|
'title' => [
|
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 128,
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
|
|
|
'slug' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 191,
|
|
|
|
],
|
2020-06-26 14:34:52 +00:00
|
|
|
'enclosure_uri' => [
|
2020-06-08 20:32:42 +00:00
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 255,
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
2020-09-04 09:09:26 +00:00
|
|
|
'enclosure_duration' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
|
|
|
'comment' => 'Playtime in seconds',
|
|
|
|
],
|
|
|
|
'enclosure_mimetype' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 255,
|
|
|
|
],
|
|
|
|
'enclosure_filesize' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
|
|
|
'comment' => 'File size in bytes',
|
|
|
|
],
|
2020-10-06 15:39:27 +00:00
|
|
|
'enclosure_headersize' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
|
|
|
'comment' => 'Header size in bytes',
|
|
|
|
],
|
2020-10-29 15:45:19 +00:00
|
|
|
'description_markdown' => [
|
|
|
|
'type' => 'TEXT',
|
|
|
|
],
|
|
|
|
'description_html' => [
|
2020-06-08 20:32:42 +00:00
|
|
|
'type' => 'TEXT',
|
|
|
|
],
|
2020-06-26 14:34:52 +00:00
|
|
|
'image_uri' => [
|
2020-06-08 20:32:42 +00:00
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 255,
|
2020-06-30 18:17:41 +02:00
|
|
|
'null' => true,
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
2020-11-24 20:18:08 +00:00
|
|
|
'transcript_uri' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 255,
|
|
|
|
'null' => true,
|
|
|
|
],
|
|
|
|
'chapters_uri' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 255,
|
|
|
|
'null' => true,
|
|
|
|
],
|
2020-10-02 15:38:16 +00:00
|
|
|
'parental_advisory' => [
|
|
|
|
'type' => 'ENUM',
|
|
|
|
'constraint' => ['clean', 'explicit'],
|
|
|
|
'null' => true,
|
|
|
|
'default' => null,
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
2020-06-12 19:31:10 +00:00
|
|
|
'number' => [
|
2020-06-08 20:32:42 +00:00
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
2020-08-21 08:41:09 +00:00
|
|
|
'null' => true,
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
|
|
|
'season_number' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
2020-08-21 08:41:09 +00:00
|
|
|
'null' => true,
|
2020-06-26 14:34:52 +00:00
|
|
|
],
|
2020-06-08 20:32:42 +00:00
|
|
|
'type' => [
|
|
|
|
'type' => 'ENUM',
|
2020-08-21 08:41:09 +00:00
|
|
|
'constraint' => ['trailer', 'full', 'bonus'],
|
2020-06-08 20:32:42 +00:00
|
|
|
'default' => 'full',
|
|
|
|
],
|
2020-10-29 15:45:19 +00:00
|
|
|
'is_blocked' => [
|
2020-06-08 20:32:42 +00:00
|
|
|
'type' => 'TINYINT',
|
|
|
|
'constraint' => 1,
|
|
|
|
'default' => 0,
|
2020-08-14 18:27:57 +00:00
|
|
|
],
|
2020-12-23 14:11:38 +00:00
|
|
|
'location_name' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 128,
|
|
|
|
'null' => true,
|
|
|
|
],
|
|
|
|
'location_geo' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 32,
|
|
|
|
'null' => true,
|
|
|
|
],
|
|
|
|
'location_osmid' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 12,
|
|
|
|
'null' => true,
|
|
|
|
],
|
2020-08-14 18:27:57 +00:00
|
|
|
'created_by' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
|
|
|
],
|
|
|
|
'updated_by' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
|
|
|
],
|
|
|
|
'published_at' => [
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
'null' => true,
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
|
|
|
'created_at' => [
|
2020-10-29 15:45:19 +00:00
|
|
|
'type' => 'DATETIME',
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
|
|
|
'updated_at' => [
|
2020-10-29 15:45:19 +00:00
|
|
|
'type' => 'DATETIME',
|
2020-06-08 20:32:42 +00:00
|
|
|
],
|
2020-06-30 18:17:41 +02:00
|
|
|
'deleted_at' => [
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
'null' => true,
|
|
|
|
],
|
2020-06-08 20:32:42 +00:00
|
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
|
|
$this->forge->addUniqueKey(['podcast_id', 'slug']);
|
|
|
|
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id');
|
2020-08-14 18:27:57 +00:00
|
|
|
$this->forge->addForeignKey('created_by', 'users', 'id');
|
|
|
|
$this->forge->addForeignKey('updated_by', 'users', 'id');
|
2020-06-08 20:32:42 +00:00
|
|
|
$this->forge->createTable('episodes');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
$this->forge->dropTable('episodes');
|
|
|
|
}
|
|
|
|
}
|