Skip to content
Snippets Groups Projects
2020-06-08-160000_add_podcasts_platforms.php 1.44 KiB
Newer Older
  • Learn to ignore specific revisions
  • <?php
    
     * Class AddAddPodcastsPlatforms
     * Creates podcasts_platforms 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 AddPodcastsPlatforms extends Migration
    
    {
        public function up()
        {
            $this->forge->addField([
                'podcast_id' => [
    
                    'unsigned' => true,
                ],
    
                'platform_slug' => [
                    'type' => 'VARCHAR',
                    'constraint' => 32,
    
                ],
                'link_url' => [
                    'type' => 'VARCHAR',
    
                'link_content' => [
                    'type' => 'VARCHAR',
                    'constraint' => 128,
                    'null' => true,
                ],
    
                    'type' => 'TINYINT',
                    'constraint' => 1,
                    'default' => 0,
                ],
    
                'is_on_embeddable_player' => [
                    'type' => 'TINYINT',
                    'constraint' => 1,
                    'default' => 0,
                ],
    
            $this->forge->addPrimaryKey(['podcast_id', 'platform_slug']);
            $this->forge->createTable('podcasts_platforms');
    
        }
    
        public function down()
        {
    
            $this->forge->dropTable('podcasts_platforms');