Skip to content
Snippets Groups Projects
2021-05-30-101500_add_podcasts.php 6.8 KiB
Newer Older
  • Learn to ignore specific revisions
  •  * Class AddPodcasts Creates podcasts table in database
    
     * @copyright  2020 Ad Aures
    
     * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
     * @link       https://castopod.org/
     */
    
    
    namespace App\Database\Migrations;
    
    
    class AddPodcasts extends BaseMigration
    
        {
            $this->forge->addField([
                'id' => [
    
                    'type'           => 'INT',
                    'unsigned'       => true,
    
                    'auto_increment' => true,
                ],
    
                'description_markdown' => [
                    'type' => 'TEXT',
                ],
                'description_html' => [
    
                    'type' => 'TEXT',
                ],
    
                    'constraint' => 2,
                ],
    
                'category_id' => [
    
                    'unsigned' => true,
    
                    'constraint' => ['clean', 'explicit'],
    
                    'constraint' => ['episodic', 'serial'],
    
                ],
                'copyright' => [
    
                ],
                'episode_description_footer_markdown' => [
                    'type' => 'TEXT',
    
                'episode_description_footer_html' => [
    
                    'constraint' => 1,
    
                    'constraint' => 1,
    
                'imported_feed_url' => [
    
                    'comment'    => 'The RSS feed URL if this podcast was imported, NULL otherwise.',
                    'null'       => true,
    
                    'comment'    => 'The RSS new feed URL if this podcast is moving out, NULL otherwise.',
                    'null'       => true,
    
                    'comment'    => 'Wallet address for Web Monetization payments',
                    'null'       => true,
    
                ],
                'location_name' => [
    
                    'constraint' => 128,
    
                ],
                'location_geo' => [
    
                    'constraint' => 32,
    
                    'constraint' => 12,
    
                'published_at' => [
                    'type' => 'DATETIME',
                    'null' => true,
                ],
    
                'created_at' => [
    
                ],
                'updated_at' => [
    
            // TODO: remove name in favor of username from actor
    
            $this->forge->addUniqueKey('handle');
    
            $this->forge->addUniqueKey('guid');
    
            $this->forge->addUniqueKey('actor_id');
    
            $this->forge->addForeignKey('actor_id', 'fediverse_actors', 'id', '', 'CASCADE');
    
            $this->forge->addForeignKey('cover_id', 'media', 'id');
    
            $this->forge->addForeignKey('banner_id', 'media', 'id', '', 'SET NULL');
    
            $this->forge->addForeignKey('category_id', 'categories', 'id');
    
            $this->forge->addForeignKey('language_code', 'languages', 'code');
    
            $this->forge->addForeignKey('created_by', 'users', 'id');
            $this->forge->addForeignKey('updated_by', 'users', 'id');
    
            $this->forge->createTable('podcasts');
        }
    
    
        {
            $this->forge->dropTable('podcasts');
        }
    }