castopod/app/Database/Migrations/2020-06-08-160000_add_podca...

59 lines
1.4 KiB
PHP
Raw Normal View History

2020-06-08 16:25:23 +02:00
<?php
2020-06-08 16:25:23 +02:00
/**
* Class AddAddPodcastsPlatforms
* Creates podcasts_platforms table in database
*
2020-06-08 16:25:23 +02:00
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
2020-06-08 16:25:23 +02:00
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
2020-06-08 16:25:23 +02:00
class AddPodcastsPlatforms extends Migration
2020-06-08 16:25:23 +02:00
{
public function up()
{
$this->forge->addField([
'podcast_id' => [
'type' => 'INT',
2020-06-08 16:25:23 +02:00
'unsigned' => true,
],
'platform_slug' => [
'type' => 'VARCHAR',
'constraint' => 32,
2020-06-08 16:25:23 +02:00
],
'link_url' => [
'type' => 'VARCHAR',
'constraint' => 512,
2020-06-08 16:25:23 +02:00
],
'link_content' => [
'type' => 'VARCHAR',
'constraint' => 128,
'null' => true,
],
'is_visible' => [
2020-06-08 16:25:23 +02:00
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
'is_on_embeddable_player' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
2020-06-08 16:25:23 +02:00
]);
$this->forge->addPrimaryKey(['podcast_id', 'platform_slug']);
$this->forge->createTable('podcasts_platforms');
2020-06-08 16:25:23 +02:00
}
public function down()
{
$this->forge->dropTable('podcasts_platforms');
2020-06-08 16:25:23 +02:00
}
}