Skip to content

Import error: unserialize(): Argument # 1 ($data) must be of type string, false given

Running v1.12.3 on Ubuntu 24.04 with PHP 8.3.6 an Nginx.

(added a space after # in the title to prevent it from linking to another issue)

When trying to sync my upstream podcast RSS feed (/cp-admin/podcasts/9/imports) I notice the following line in ~/castopod/writable/logs/log-2024-07-07.log:

ERROR - 2024-07-07 08:15:04 --> unserialize(): Argument #1 ($data) must be of type string, false given

The sync fails, though I'm not sure if that's related. It says "Import task could not complete: script failure" with "Process was killed." in the (?) popup.

Here's a dump of my database structure:
/*!999999\- enable the sandbox mode */ 
-- MariaDB dump 10.19  Distrib 10.11.8-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: podcast
-- ------------------------------------------------------
-- Server version	10.11.8-MariaDB-0ubuntu0.24.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `cp_analytics_podcasts`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `duration` decimal(15,3) unsigned NOT NULL,
  `bandwidth` bigint(20) unsigned NOT NULL,
  `unique_listeners` int(10) unsigned NOT NULL DEFAULT 1,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_podcasts_by_country`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts_by_country`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts_by_country` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `country_code` varchar(3) NOT NULL COMMENT 'ISO 3166-1 code.',
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`country_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_podcasts_by_episode`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts_by_episode`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts_by_episode` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `episode_id` int(10) unsigned NOT NULL,
  `age` int(10) unsigned NOT NULL COMMENT 'Days since episode publication date',
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`episode_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_podcasts_by_hour`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts_by_hour`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts_by_hour` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `hour` int(10) unsigned NOT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`hour`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_podcasts_by_player`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts_by_player`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts_by_player` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `service` varchar(128) NOT NULL,
  `app` varchar(128) NOT NULL,
  `device` varchar(32) NOT NULL,
  `os` varchar(32) NOT NULL,
  `is_bot` tinyint(1) NOT NULL DEFAULT 0,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`service`,`app`,`device`,`os`,`is_bot`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_podcasts_by_region`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts_by_region`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts_by_region` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `country_code` varchar(3) NOT NULL COMMENT 'ISO 3166-1 code.',
  `region_code` varchar(3) NOT NULL COMMENT 'ISO 3166-2 code.',
  `latitude` decimal(8,6) DEFAULT NULL,
  `longitude` decimal(9,6) DEFAULT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`country_code`,`region_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_podcasts_by_subscription`
--

DROP TABLE IF EXISTS `cp_analytics_podcasts_by_subscription`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_podcasts_by_subscription` (
  `podcast_id` int(10) unsigned NOT NULL,
  `episode_id` int(10) unsigned NOT NULL,
  `subscription_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`episode_id`,`subscription_id`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_unknown_useragents`
--

DROP TABLE IF EXISTS `cp_analytics_unknown_useragents`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_unknown_useragents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `useragent` varchar(255) NOT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `useragent` (`useragent`)
) ENGINE=InnoDB AUTO_INCREMENT=1391 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_website_by_browser`
--

DROP TABLE IF EXISTS `cp_analytics_website_by_browser`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_website_by_browser` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `browser` varchar(128) NOT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`browser`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_website_by_entry_page`
--

DROP TABLE IF EXISTS `cp_analytics_website_by_entry_page`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_website_by_entry_page` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `entry_page_url` varchar(512) NOT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`entry_page_url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_analytics_website_by_referer`
--

DROP TABLE IF EXISTS `cp_analytics_website_by_referer`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_analytics_website_by_referer` (
  `podcast_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `referer_url` varchar(512) NOT NULL,
  `domain` varchar(128) DEFAULT NULL,
  `keywords` varchar(384) DEFAULT NULL,
  `hits` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`podcast_id`,`date`,`referer_url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_auth_groups_users`
--

DROP TABLE IF EXISTS `cp_auth_groups_users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_auth_groups_users` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL,
  `group` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cp_auth_groups_users_user_id_foreign` (`user_id`),
  CONSTRAINT `cp_auth_groups_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `cp_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_auth_identities`
--

DROP TABLE IF EXISTS `cp_auth_identities`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_auth_identities` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL,
  `type` varchar(255) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `secret` varchar(255) NOT NULL,
  `secret2` varchar(255) DEFAULT NULL,
  `expires` datetime DEFAULT NULL,
  `extra` text DEFAULT NULL,
  `force_reset` tinyint(1) NOT NULL DEFAULT 0,
  `last_used_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `type_secret` (`type`,`secret`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `cp_auth_identities_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `cp_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_auth_logins`
--

DROP TABLE IF EXISTS `cp_auth_logins`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_auth_logins` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(255) NOT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `id_type` varchar(255) NOT NULL,
  `identifier` varchar(255) NOT NULL,
  `user_id` int(11) unsigned DEFAULT NULL,
  `date` datetime NOT NULL,
  `success` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id_type_identifier` (`id_type`,`identifier`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_auth_permissions_users`
--

DROP TABLE IF EXISTS `cp_auth_permissions_users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_auth_permissions_users` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL,
  `permission` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cp_auth_permissions_users_user_id_foreign` (`user_id`),
  CONSTRAINT `cp_auth_permissions_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `cp_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_auth_remember_tokens`
--

DROP TABLE IF EXISTS `cp_auth_remember_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_auth_remember_tokens` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `selector` varchar(255) NOT NULL,
  `hashedValidator` varchar(255) NOT NULL,
  `user_id` int(11) unsigned NOT NULL,
  `expires` datetime NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `selector` (`selector`),
  KEY `cp_auth_remember_tokens_user_id_foreign` (`user_id`),
  CONSTRAINT `cp_auth_remember_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `cp_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_auth_token_logins`
--

DROP TABLE IF EXISTS `cp_auth_token_logins`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_auth_token_logins` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(255) NOT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `id_type` varchar(255) NOT NULL,
  `identifier` varchar(255) NOT NULL,
  `user_id` int(11) unsigned DEFAULT NULL,
  `date` datetime NOT NULL,
  `success` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id_type_identifier` (`id_type`,`identifier`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_categories`
--

DROP TABLE IF EXISTS `cp_categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_categories` (
  `id` int(10) unsigned NOT NULL,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `code` varchar(32) NOT NULL,
  `apple_category` varchar(32) NOT NULL,
  `google_category` varchar(32) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`),
  KEY `cp_categories_parent_id_foreign` (`parent_id`),
  CONSTRAINT `cp_categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `cp_categories` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_clips`
--

DROP TABLE IF EXISTS `cp_clips`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_clips` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `podcast_id` int(10) unsigned NOT NULL,
  `episode_id` int(10) unsigned NOT NULL,
  `start_time` decimal(8,3) unsigned NOT NULL,
  `duration` decimal(7,3) unsigned NOT NULL,
  `title` varchar(128) NOT NULL,
  `type` enum('audio','video') NOT NULL,
  `media_id` int(10) unsigned DEFAULT NULL,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `status` enum('queued','pending','running','passed','failed') NOT NULL,
  `logs` text NOT NULL,
  `created_by` int(10) unsigned NOT NULL,
  `updated_by` int(10) unsigned NOT NULL,
  `job_started_at` datetime DEFAULT NULL,
  `job_ended_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cp_clips_podcast_id_foreign` (`podcast_id`),
  KEY `cp_clips_episode_id_foreign` (`episode_id`),
  KEY `cp_clips_media_id_foreign` (`media_id`),
  KEY `cp_clips_created_by_foreign` (`created_by`),
  KEY `cp_clips_updated_by_foreign` (`updated_by`),
  CONSTRAINT `cp_clips_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_clips_episode_id_foreign` FOREIGN KEY (`episode_id`) REFERENCES `cp_episodes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_clips_media_id_foreign` FOREIGN KEY (`media_id`) REFERENCES `cp_media` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_clips_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_clips_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `cp_users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Temporary table structure for view `cp_credits`
--

DROP TABLE IF EXISTS `cp_credits`;
/*!50001 DROP VIEW IF EXISTS `cp_credits`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `cp_credits` AS SELECT
 1 AS `person_group`,
  1 AS `person_id`,
  1 AS `full_name`,
  1 AS `person_role`,
  1 AS `podcast_id`,
  1 AS `episode_id` */;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `cp_episode_comments`
--

DROP TABLE IF EXISTS `cp_episode_comments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_episode_comments` (
  `id` binary(16) NOT NULL,
  `uri` varchar(255) NOT NULL,
  `episode_id` int(10) unsigned NOT NULL,
  `actor_id` int(10) unsigned NOT NULL,
  `in_reply_to_id` binary(16) DEFAULT NULL,
  `message` varchar(5000) NOT NULL,
  `message_html` varchar(6000) NOT NULL,
  `likes_count` int(10) unsigned NOT NULL,
  `replies_count` int(10) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cp_episode_comments_episode_id_foreign` (`episode_id`),
  KEY `cp_episode_comments_actor_id_foreign` (`actor_id`),
  KEY `cp_episode_comments_created_by_foreign` (`created_by`),
  CONSTRAINT `cp_episode_comments_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_episode_comments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_episode_comments_episode_id_foreign` FOREIGN KEY (`episode_id`) REFERENCES `cp_episodes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_episodes`
--

DROP TABLE IF EXISTS `cp_episodes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_episodes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `podcast_id` int(10) unsigned NOT NULL,
  `preview_id` binary(16) DEFAULT NULL,
  `guid` varchar(255) NOT NULL,
  `title` varchar(128) NOT NULL,
  `slug` varchar(128) NOT NULL,
  `audio_id` int(10) unsigned NOT NULL,
  `description_markdown` text NOT NULL,
  `description_html` text NOT NULL,
  `cover_id` int(10) unsigned DEFAULT NULL,
  `transcript_id` int(10) unsigned DEFAULT NULL,
  `transcript_remote_url` varchar(512) DEFAULT NULL,
  `chapters_id` int(10) unsigned DEFAULT NULL,
  `chapters_remote_url` varchar(512) DEFAULT NULL,
  `parental_advisory` enum('clean','explicit') DEFAULT NULL,
  `number` int(10) unsigned DEFAULT NULL,
  `season_number` int(10) unsigned DEFAULT NULL,
  `type` enum('trailer','full','bonus') NOT NULL DEFAULT 'full',
  `is_blocked` tinyint(1) NOT NULL DEFAULT 0,
  `location_name` varchar(128) DEFAULT NULL,
  `location_geo` varchar(32) DEFAULT NULL,
  `location_osm` varchar(12) DEFAULT NULL,
  `custom_rss` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`custom_rss`)),
  `is_published_on_hubs` tinyint(1) NOT NULL DEFAULT 0,
  `posts_count` int(10) unsigned NOT NULL DEFAULT 0,
  `comments_count` int(10) unsigned NOT NULL DEFAULT 0,
  `is_premium` tinyint(1) NOT NULL DEFAULT 0,
  `created_by` int(10) unsigned NOT NULL,
  `updated_by` int(10) unsigned NOT NULL,
  `published_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `podcast_id_slug` (`podcast_id`,`slug`),
  UNIQUE KEY `preview_id` (`preview_id`),
  KEY `cp_episodes_audio_id_foreign` (`audio_id`),
  KEY `cp_episodes_cover_id_foreign` (`cover_id`),
  KEY `cp_episodes_transcript_id_foreign` (`transcript_id`),
  KEY `cp_episodes_chapters_id_foreign` (`chapters_id`),
  KEY `cp_episodes_created_by_foreign` (`created_by`),
  KEY `cp_episodes_updated_by_foreign` (`updated_by`),
  FULLTEXT KEY `episodes_search` (`title`,`description_markdown`,`slug`,`location_name`),
  CONSTRAINT `cp_episodes_audio_id_foreign` FOREIGN KEY (`audio_id`) REFERENCES `cp_media` (`id`),
  CONSTRAINT `cp_episodes_chapters_id_foreign` FOREIGN KEY (`chapters_id`) REFERENCES `cp_media` (`id`) ON DELETE SET NULL,
  CONSTRAINT `cp_episodes_cover_id_foreign` FOREIGN KEY (`cover_id`) REFERENCES `cp_media` (`id`) ON DELETE SET NULL,
  CONSTRAINT `cp_episodes_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_episodes_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_episodes_transcript_id_foreign` FOREIGN KEY (`transcript_id`) REFERENCES `cp_media` (`id`) ON DELETE SET NULL,
  CONSTRAINT `cp_episodes_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `cp_users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=265 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_episodes_persons`
--

DROP TABLE IF EXISTS `cp_episodes_persons`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_episodes_persons` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `podcast_id` int(10) unsigned NOT NULL,
  `episode_id` int(10) unsigned NOT NULL,
  `person_id` int(10) unsigned NOT NULL,
  `person_group` varchar(32) NOT NULL,
  `person_role` varchar(32) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `podcast_id_episode_id_person_id_person_group_person_role` (`podcast_id`,`episode_id`,`person_id`,`person_group`,`person_role`),
  KEY `cp_episodes_persons_episode_id_foreign` (`episode_id`),
  KEY `cp_episodes_persons_person_id_foreign` (`person_id`),
  CONSTRAINT `cp_episodes_persons_episode_id_foreign` FOREIGN KEY (`episode_id`) REFERENCES `cp_episodes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_episodes_persons_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `cp_persons` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_episodes_persons_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_activities`
--

DROP TABLE IF EXISTS `cp_fediverse_activities`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_activities` (
  `id` binary(16) NOT NULL,
  `actor_id` int(10) unsigned NOT NULL,
  `target_actor_id` int(10) unsigned DEFAULT NULL,
  `post_id` binary(16) DEFAULT NULL,
  `type` varchar(100) NOT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`payload`)),
  `status` enum('queued','delivered') DEFAULT NULL,
  `scheduled_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cp_fediverse_activities_actor_id_foreign` (`actor_id`),
  KEY `cp_fediverse_activities_target_actor_id_foreign` (`target_actor_id`),
  KEY `cp_fediverse_activities_post_id_foreign` (`post_id`),
  CONSTRAINT `cp_fediverse_activities_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_activities_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `cp_fediverse_posts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_activities_target_actor_id_foreign` FOREIGN KEY (`target_actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_actors`
--

DROP TABLE IF EXISTS `cp_fediverse_actors`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_actors` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uri` varchar(255) NOT NULL,
  `username` varchar(32) NOT NULL,
  `domain` varchar(255) NOT NULL,
  `private_key` text DEFAULT NULL,
  `public_key` text DEFAULT NULL,
  `display_name` varchar(128) NOT NULL,
  `summary` text DEFAULT NULL,
  `avatar_image_url` varchar(255) DEFAULT NULL,
  `avatar_image_mimetype` varchar(13) DEFAULT NULL,
  `cover_image_url` varchar(255) DEFAULT NULL,
  `cover_image_mimetype` varchar(13) DEFAULT NULL,
  `inbox_url` varchar(255) NOT NULL,
  `outbox_url` varchar(255) DEFAULT NULL,
  `followers_url` varchar(255) DEFAULT NULL,
  `followers_count` int(10) unsigned NOT NULL DEFAULT 0,
  `posts_count` int(10) unsigned NOT NULL DEFAULT 0,
  `is_blocked` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uri` (`uri`),
  UNIQUE KEY `username_domain` (`username`,`domain`)
) ENGINE=InnoDB AUTO_INCREMENT=1769 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_blocked_domains`
--

DROP TABLE IF EXISTS `cp_fediverse_blocked_domains`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_blocked_domains` (
  `name` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_favourites`
--

DROP TABLE IF EXISTS `cp_fediverse_favourites`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_favourites` (
  `actor_id` int(10) unsigned NOT NULL,
  `post_id` binary(16) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`actor_id`,`post_id`),
  KEY `cp_fediverse_favourites_post_id_foreign` (`post_id`),
  CONSTRAINT `cp_fediverse_favourites_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_favourites_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `cp_fediverse_posts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_follows`
--

DROP TABLE IF EXISTS `cp_fediverse_follows`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_follows` (
  `actor_id` int(10) unsigned NOT NULL COMMENT 'Actor that is following',
  `target_actor_id` int(10) unsigned NOT NULL COMMENT 'Actor that is followed',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`actor_id`,`target_actor_id`),
  KEY `cp_fediverse_follows_target_actor_id_foreign` (`target_actor_id`),
  CONSTRAINT `cp_fediverse_follows_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_follows_target_actor_id_foreign` FOREIGN KEY (`target_actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_notifications`
--

DROP TABLE IF EXISTS `cp_fediverse_notifications`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_notifications` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `actor_id` int(10) unsigned NOT NULL,
  `target_actor_id` int(10) unsigned NOT NULL,
  `post_id` binary(16) DEFAULT NULL,
  `activity_id` binary(16) NOT NULL,
  `type` enum('like','follow','share','reply') NOT NULL,
  `read_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cp_fediverse_notifications_actor_id_foreign` (`actor_id`),
  KEY `cp_fediverse_notifications_target_actor_id_foreign` (`target_actor_id`),
  KEY `cp_fediverse_notifications_post_id_foreign` (`post_id`),
  KEY `cp_fediverse_notifications_activity_id_foreign` (`activity_id`),
  CONSTRAINT `cp_fediverse_notifications_activity_id_foreign` FOREIGN KEY (`activity_id`) REFERENCES `cp_fediverse_activities` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_notifications_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_notifications_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `cp_fediverse_posts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_notifications_target_actor_id_foreign` FOREIGN KEY (`target_actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_posts`
--

DROP TABLE IF EXISTS `cp_fediverse_posts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_posts` (
  `id` binary(16) NOT NULL,
  `uri` varchar(255) NOT NULL,
  `actor_id` int(10) unsigned NOT NULL,
  `in_reply_to_id` binary(16) DEFAULT NULL,
  `reblog_of_id` binary(16) DEFAULT NULL,
  `message` varchar(500) DEFAULT NULL,
  `message_html` varchar(600) DEFAULT NULL,
  `favourites_count` int(10) unsigned NOT NULL DEFAULT 0,
  `reblogs_count` int(10) unsigned NOT NULL DEFAULT 0,
  `replies_count` int(10) unsigned NOT NULL DEFAULT 0,
  `episode_id` int(10) unsigned DEFAULT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `published_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uri` (`uri`),
  KEY `cp_fediverse_posts_actor_id_foreign` (`actor_id`),
  KEY `cp_fediverse_posts_in_reply_to_id_foreign` (`in_reply_to_id`),
  KEY `cp_fediverse_posts_reblog_of_id_foreign` (`reblog_of_id`),
  KEY `cp_fediverse_posts_episode_id_foreign` (`episode_id`),
  KEY `cp_fediverse_posts_created_by_foreign` (`created_by`),
  CONSTRAINT `cp_fediverse_posts_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_posts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_posts_episode_id_foreign` FOREIGN KEY (`episode_id`) REFERENCES `cp_episodes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_posts_in_reply_to_id_foreign` FOREIGN KEY (`in_reply_to_id`) REFERENCES `cp_fediverse_posts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_posts_reblog_of_id_foreign` FOREIGN KEY (`reblog_of_id`) REFERENCES `cp_fediverse_posts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_posts_preview_cards`
--

DROP TABLE IF EXISTS `cp_fediverse_posts_preview_cards`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_posts_preview_cards` (
  `post_id` binary(16) NOT NULL,
  `preview_card_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`post_id`,`preview_card_id`),
  KEY `cp_fediverse_posts_preview_cards_preview_card_id_foreign` (`preview_card_id`),
  CONSTRAINT `cp_fediverse_posts_preview_cards_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `cp_fediverse_posts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_fediverse_posts_preview_cards_preview_card_id_foreign` FOREIGN KEY (`preview_card_id`) REFERENCES `cp_fediverse_preview_cards` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_fediverse_preview_cards`
--

DROP TABLE IF EXISTS `cp_fediverse_preview_cards`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_fediverse_preview_cards` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `url` varchar(512) NOT NULL,
  `title` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `type` enum('link','video','image','rich') NOT NULL DEFAULT 'link',
  `author_name` varchar(64) DEFAULT NULL,
  `author_url` varchar(255) DEFAULT NULL,
  `provider_name` varchar(255) NOT NULL,
  `provider_url` varchar(255) NOT NULL,
  `image` varchar(255) NOT NULL,
  `html` text NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `url` (`url`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_languages`
--

DROP TABLE IF EXISTS `cp_languages`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_languages` (
  `code` varchar(2) NOT NULL COMMENT 'ISO 639-1 language code',
  `native_name` varchar(128) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_likes`
--

DROP TABLE IF EXISTS `cp_likes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_likes` (
  `actor_id` int(10) unsigned NOT NULL,
  `comment_id` binary(16) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`actor_id`,`comment_id`),
  KEY `cp_likes_comment_id_foreign` (`comment_id`),
  CONSTRAINT `cp_likes_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_likes_comment_id_foreign` FOREIGN KEY (`comment_id`) REFERENCES `cp_episode_comments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_media`
--

DROP TABLE IF EXISTS `cp_media`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_media` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `file_key` varchar(255) NOT NULL,
  `file_size` int(10) unsigned NOT NULL COMMENT 'File size in bytes',
  `file_mimetype` varchar(45) NOT NULL,
  `file_metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`file_metadata`)),
  `type` enum('image','audio','video','transcript','chapters','document') NOT NULL DEFAULT 'document',
  `description` text DEFAULT NULL,
  `language_code` varchar(2) DEFAULT NULL,
  `uploaded_by` int(11) unsigned NOT NULL,
  `updated_by` int(11) unsigned NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `file_path` (`file_key`),
  KEY `cp_media_uploaded_by_foreign` (`uploaded_by`),
  KEY `cp_media_updated_by_foreign` (`updated_by`),
  CONSTRAINT `cp_media_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_media_uploaded_by_foreign` FOREIGN KEY (`uploaded_by`) REFERENCES `cp_users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=542 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_migrations`
--

DROP TABLE IF EXISTS `cp_migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_migrations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `version` varchar(255) NOT NULL,
  `class` varchar(255) NOT NULL,
  `group` varchar(255) NOT NULL,
  `namespace` varchar(255) NOT NULL,
  `time` int(11) NOT NULL,
  `batch` int(11) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_pages`
--

DROP TABLE IF EXISTS `cp_pages`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_pages` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `slug` varchar(128) NOT NULL,
  `content_markdown` text NOT NULL,
  `content_html` text NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_persons`
--

DROP TABLE IF EXISTS `cp_persons`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_persons` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `full_name` varchar(192) NOT NULL COMMENT 'This is the full name or alias of the person.',
  `unique_name` varchar(192) NOT NULL COMMENT 'This is the slug name or alias of the person.',
  `information_url` varchar(512) DEFAULT NULL COMMENT 'The url to a relevant resource of information about the person, such as a homepage or third-party profile platform.',
  `avatar_id` int(10) unsigned DEFAULT NULL,
  `created_by` int(10) unsigned NOT NULL,
  `updated_by` int(10) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_name` (`unique_name`),
  KEY `cp_persons_avatar_id_foreign` (`avatar_id`),
  KEY `cp_persons_created_by_foreign` (`created_by`),
  KEY `cp_persons_updated_by_foreign` (`updated_by`),
  CONSTRAINT `cp_persons_avatar_id_foreign` FOREIGN KEY (`avatar_id`) REFERENCES `cp_media` (`id`) ON DELETE SET NULL,
  CONSTRAINT `cp_persons_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_persons_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `cp_users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_platforms`
--

DROP TABLE IF EXISTS `cp_platforms`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_platforms` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `podcast_id` int(10) unsigned NOT NULL,
  `type` enum('podcasting','social','funding') NOT NULL,
  `slug` varchar(32) NOT NULL,
  `link_url` varchar(512) NOT NULL,
  `account_id` varchar(128) DEFAULT NULL,
  `is_visible` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `podcast_id_type_slug` (`podcast_id`,`type`,`slug`),
  CONSTRAINT `platforms_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_podcasts`
--

DROP TABLE IF EXISTS `cp_podcasts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_podcasts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `guid` char(36) NOT NULL,
  `actor_id` int(10) unsigned NOT NULL,
  `handle` varchar(32) NOT NULL,
  `title` varchar(128) NOT NULL,
  `description_markdown` text NOT NULL,
  `description_html` text NOT NULL,
  `cover_id` int(10) unsigned NOT NULL,
  `banner_id` int(10) unsigned DEFAULT NULL,
  `language_code` varchar(2) NOT NULL,
  `category_id` int(10) unsigned NOT NULL DEFAULT 0,
  `parental_advisory` enum('clean','explicit') DEFAULT NULL,
  `owner_name` varchar(128) NOT NULL,
  `owner_email` varchar(255) NOT NULL,
  `is_owner_email_removed_from_feed` tinyint(1) NOT NULL DEFAULT 0,
  `publisher` varchar(128) DEFAULT NULL,
  `type` enum('episodic','serial') NOT NULL DEFAULT 'episodic',
  `medium` enum('podcast','music','audiobook') NOT NULL DEFAULT 'podcast',
  `copyright` varchar(128) DEFAULT NULL,
  `episode_description_footer_markdown` text DEFAULT NULL,
  `episode_description_footer_html` text DEFAULT NULL,
  `is_blocked` tinyint(1) NOT NULL DEFAULT 0,
  `is_completed` tinyint(1) NOT NULL DEFAULT 0,
  `is_locked` tinyint(1) NOT NULL DEFAULT 1,
  `imported_feed_url` varchar(512) DEFAULT NULL COMMENT 'The RSS feed URL if this podcast was imported, NULL otherwise.',
  `new_feed_url` varchar(512) DEFAULT NULL COMMENT 'The RSS new feed URL if this podcast is moving out, NULL otherwise.',
  `payment_pointer` varchar(128) DEFAULT NULL COMMENT 'Wallet address for Web Monetization payments',
  `location_name` varchar(128) DEFAULT NULL,
  `location_geo` varchar(32) DEFAULT NULL,
  `location_osm` varchar(12) DEFAULT NULL,
  `verify_txt` text DEFAULT NULL,
  `custom_rss` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`custom_rss`)),
  `is_published_on_hubs` tinyint(1) NOT NULL DEFAULT 0,
  `partner_id` varchar(32) DEFAULT NULL,
  `partner_link_url` varchar(512) DEFAULT NULL,
  `partner_image_url` varchar(512) DEFAULT NULL,
  `is_premium_by_default` tinyint(1) NOT NULL DEFAULT 0,
  `created_by` int(10) unsigned NOT NULL,
  `updated_by` int(10) unsigned NOT NULL,
  `published_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `handle` (`handle`),
  UNIQUE KEY `guid` (`guid`),
  UNIQUE KEY `actor_id` (`actor_id`),
  KEY `cp_podcasts_cover_id_foreign` (`cover_id`),
  KEY `cp_podcasts_banner_id_foreign` (`banner_id`),
  KEY `cp_podcasts_category_id_foreign` (`category_id`),
  KEY `cp_podcasts_language_code_foreign` (`language_code`),
  KEY `cp_podcasts_created_by_foreign` (`created_by`),
  KEY `cp_podcasts_updated_by_foreign` (`updated_by`),
  FULLTEXT KEY `podcasts_search` (`title`,`description_markdown`,`handle`,`location_name`),
  CONSTRAINT `cp_podcasts_actor_id_foreign` FOREIGN KEY (`actor_id`) REFERENCES `cp_fediverse_actors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_podcasts_banner_id_foreign` FOREIGN KEY (`banner_id`) REFERENCES `cp_media` (`id`) ON DELETE SET NULL,
  CONSTRAINT `cp_podcasts_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `cp_categories` (`id`),
  CONSTRAINT `cp_podcasts_cover_id_foreign` FOREIGN KEY (`cover_id`) REFERENCES `cp_media` (`id`),
  CONSTRAINT `cp_podcasts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_podcasts_language_code_foreign` FOREIGN KEY (`language_code`) REFERENCES `cp_languages` (`code`),
  CONSTRAINT `cp_podcasts_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `cp_users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_podcasts_categories`
--

DROP TABLE IF EXISTS `cp_podcasts_categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_podcasts_categories` (
  `podcast_id` int(10) unsigned NOT NULL,
  `category_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`podcast_id`,`category_id`),
  KEY `cp_podcasts_categories_category_id_foreign` (`category_id`),
  CONSTRAINT `cp_podcasts_categories_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `cp_categories` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_podcasts_categories_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_podcasts_persons`
--

DROP TABLE IF EXISTS `cp_podcasts_persons`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_podcasts_persons` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `podcast_id` int(10) unsigned NOT NULL,
  `person_id` int(10) unsigned NOT NULL,
  `person_group` varchar(32) NOT NULL,
  `person_role` varchar(32) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `podcast_id_person_id_person_group_person_role` (`podcast_id`,`person_id`,`person_group`,`person_role`),
  KEY `cp_podcasts_persons_person_id_foreign` (`person_id`),
  CONSTRAINT `cp_podcasts_persons_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `cp_persons` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_podcasts_persons_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_settings`
--

DROP TABLE IF EXISTS `cp_settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_settings` (
  `id` int(9) NOT NULL AUTO_INCREMENT,
  `class` varchar(255) NOT NULL,
  `key` varchar(255) NOT NULL,
  `value` text DEFAULT NULL,
  `type` varchar(31) NOT NULL DEFAULT 'string',
  `context` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_subscriptions`
--

DROP TABLE IF EXISTS `cp_subscriptions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_subscriptions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `podcast_id` int(10) unsigned NOT NULL,
  `email` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `status` enum('active','suspended') NOT NULL DEFAULT 'active',
  `status_message` varchar(255) DEFAULT NULL,
  `expires_at` datetime DEFAULT NULL,
  `created_by` int(10) unsigned NOT NULL,
  `updated_by` int(10) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `podcast_id_email` (`podcast_id`,`email`),
  UNIQUE KEY `token` (`token`),
  KEY `cp_subscriptions_created_by_foreign` (`created_by`),
  KEY `cp_subscriptions_updated_by_foreign` (`updated_by`),
  CONSTRAINT `cp_subscriptions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `cp_users` (`id`),
  CONSTRAINT `cp_subscriptions_podcast_id_foreign` FOREIGN KEY (`podcast_id`) REFERENCES `cp_podcasts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cp_subscriptions_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `cp_users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cp_users`
--

DROP TABLE IF EXISTS `cp_users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cp_users` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(30) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `status_message` varchar(255) DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 0,
  `last_active` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `is_owner` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Final view structure for view `cp_credits`
--

/*!50001 DROP VIEW IF EXISTS `cp_credits`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8mb4 */;
/*!50001 SET character_set_results     = utf8mb4 */;
/*!50001 SET collation_connection      = utf8mb4_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`podcast`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `cp_credits` AS select `cp_podcasts_persons`.`person_group` AS `person_group`,`cp_podcasts_persons`.`person_id` AS `person_id`,`cp_persons`.`full_name` AS `full_name`,`cp_podcasts_persons`.`person_role` AS `person_role`,`cp_podcasts_persons`.`podcast_id` AS `podcast_id`,NULL AS `episode_id` from (`cp_podcasts_persons` join `cp_persons` on(`cp_podcasts_persons`.`person_id` = `cp_persons`.`id`)) union select `cp_episodes_persons`.`person_group` AS `person_group`,`cp_episodes_persons`.`person_id` AS `person_id`,`cp_persons`.`full_name` AS `full_name`,`cp_episodes_persons`.`person_role` AS `person_role`,`cp_episodes_persons`.`podcast_id` AS `podcast_id`,`cp_episodes_persons`.`episode_id` AS `episode_id` from ((`cp_episodes_persons` join `cp_persons` on(`cp_episodes_persons`.`person_id` = `cp_persons`.`id`)) join `cp_episodes` on(`cp_episodes_persons`.`episode_id` = `cp_episodes`.`id`)) where `cp_episodes`.`published_at` <= utc_timestamp() order by `person_group`,`full_name`,`person_role`,`podcast_id`,`episode_id` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2024-07-07  8:25:21

The last migration (from v1.11.0) didn't go smoothly because I had not given the DROP privilege, though it worked the second time.

Edited by Sjors Provoost