Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • adaures/castopod
  • mkljczk/castopod-host
  • spaetz/castopod-host
  • PatrykMis/castopod
  • jonas/castopod
  • ajeremias/castopod
  • misuzu/castopod
  • KrzysztofDomanczyk/castopod
  • Behel/castopod
  • nebulon/castopod
  • ewen/castopod
  • NeoluxConsulting/castopod
  • nateritter/castopod-og
  • prcutler/castopod
14 results
Show changes
Showing
with 425 additions and 4 deletions
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcastsPersons extends BaseMigration class AddPodcastsPersons extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -46,6 +49,7 @@ class AddPodcastsPersons extends BaseMigration ...@@ -46,6 +49,7 @@ class AddPodcastsPersons extends BaseMigration
$this->forge->createTable('podcasts_persons'); $this->forge->createTable('podcasts_persons');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('podcasts_persons'); $this->forge->dropTable('podcasts_persons');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddEpisodesPersons extends BaseMigration class AddEpisodesPersons extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -51,6 +54,7 @@ class AddEpisodesPersons extends BaseMigration ...@@ -51,6 +54,7 @@ class AddEpisodesPersons extends BaseMigration
$this->forge->createTable('episodes_persons'); $this->forge->createTable('episodes_persons');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('episodes_persons'); $this->forge->dropTable('episodes_persons');
......
...@@ -10,8 +10,11 @@ declare(strict_types=1); ...@@ -10,8 +10,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddCreditsView extends BaseMigration class AddCreditsView extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
// Creates View for credit UNION query // Creates View for credit UNION query
...@@ -37,6 +40,7 @@ class AddCreditsView extends BaseMigration ...@@ -37,6 +40,7 @@ class AddCreditsView extends BaseMigration
$this->db->query($createQuery); $this->db->query($createQuery);
} }
#[Override]
public function down(): void public function down(): void
{ {
$viewName = $this->db->prefixTable('credits'); $viewName = $this->db->prefixTable('credits');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddEpisodeIdToPosts extends BaseMigration class AddEpisodeIdToPosts extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
...@@ -33,11 +36,12 @@ class AddEpisodeIdToPosts extends BaseMigration ...@@ -33,11 +36,12 @@ class AddEpisodeIdToPosts extends BaseMigration
'id', 'id',
'', '',
'CASCADE', 'CASCADE',
$prefix . 'fediverse_posts_episode_id_foreign' $prefix . 'fediverse_posts_episode_id_foreign',
); );
$this->forge->processIndexes('fediverse_posts'); $this->forge->processIndexes('fediverse_posts');
} }
#[Override]
public function down(): void public function down(): void
{ {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddCreatedByToPosts extends BaseMigration class AddCreatedByToPosts extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
...@@ -33,11 +36,12 @@ class AddCreatedByToPosts extends BaseMigration ...@@ -33,11 +36,12 @@ class AddCreatedByToPosts extends BaseMigration
'id', 'id',
'', '',
'CASCADE', 'CASCADE',
$prefix . 'fediverse_posts_created_by_foreign' $prefix . 'fediverse_posts_created_by_foreign',
); );
$this->forge->processIndexes('fediverse_posts'); $this->forge->processIndexes('fediverse_posts');
} }
#[Override]
public function down(): void public function down(): void
{ {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
......
...@@ -4,8 +4,11 @@ declare(strict_types=1); ...@@ -4,8 +4,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddFullTextSearchIndexes extends BaseMigration class AddFullTextSearchIndexes extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
...@@ -31,6 +34,7 @@ class AddFullTextSearchIndexes extends BaseMigration ...@@ -31,6 +34,7 @@ class AddFullTextSearchIndexes extends BaseMigration
$this->db->query($createQuery); $this->db->query($createQuery);
} }
#[Override]
public function down(): void public function down(): void
{ {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
......
...@@ -4,8 +4,11 @@ declare(strict_types=1); ...@@ -4,8 +4,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddEpisodePreviewId extends BaseMigration class AddEpisodePreviewId extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$fields = [ $fields = [
...@@ -28,6 +31,7 @@ class AddEpisodePreviewId extends BaseMigration ...@@ -28,6 +31,7 @@ class AddEpisodePreviewId extends BaseMigration
$this->db->query($uniquePreviewId); $this->db->query($uniquePreviewId);
} }
#[Override]
public function down(): void public function down(): void
{ {
$fields = ['preview_id']; $fields = ['preview_id'];
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcastsOwnerEmailRemovedFromFeed extends BaseMigration class AddPodcastsOwnerEmailRemovedFromFeed extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$fields = [ $fields = [
...@@ -28,6 +31,7 @@ class AddPodcastsOwnerEmailRemovedFromFeed extends BaseMigration ...@@ -28,6 +31,7 @@ class AddPodcastsOwnerEmailRemovedFromFeed extends BaseMigration
$this->forge->addColumn('podcasts', $fields); $this->forge->addColumn('podcasts', $fields);
} }
#[Override]
public function down(): void public function down(): void
{ {
$fields = ['is_owner_email_removed_from_feed']; $fields = ['is_owner_email_removed_from_feed'];
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcastsMediumField extends BaseMigration class AddPodcastsMediumField extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$fields = [ $fields = [
...@@ -28,6 +31,7 @@ class AddPodcastsMediumField extends BaseMigration ...@@ -28,6 +31,7 @@ class AddPodcastsMediumField extends BaseMigration
$this->forge->addColumn('podcasts', $fields); $this->forge->addColumn('podcasts', $fields);
} }
#[Override]
public function down(): void public function down(): void
{ {
$fields = ['medium']; $fields = ['medium'];
......
<?php
declare(strict_types=1);
/**
* Class AddPodcastsVerifyTxtField adds 1 field to podcast table in database to support podcast:txt tag
*
* @copyright 2024 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Migrations;
use Override;
class AddPodcastsVerifyTxtField extends BaseMigration
{
#[Override]
public function up(): void
{
$fields = [
'verify_txt' => [
'type' => 'TEXT',
'null' => true,
'after' => 'location_osm',
],
];
$this->forge->addColumn('podcasts', $fields);
}
#[Override]
public function down(): void
{
$this->forge->dropColumn('podcasts', 'verify_txt');
}
}
<?php
declare(strict_types=1);
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use Override;
class RefactorPlatforms extends Migration
{
#[Override]
public function up(): void
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true,
],
'podcast_id' => [
'type' => 'INT',
'unsigned' => true,
],
'type' => [
'type' => 'ENUM',
'constraint' => ['podcasting', 'social', 'funding'],
'after' => 'podcast_id',
],
'slug' => [
'type' => 'VARCHAR',
'constraint' => 32,
],
'link_url' => [
'type' => 'VARCHAR',
'constraint' => 512,
],
'account_id' => [
'type' => 'VARCHAR',
'constraint' => 128,
'null' => true,
],
'is_visible' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
]);
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE', 'platforms_podcast_id_foreign');
$this->forge->addUniqueKey(['podcast_id', 'type', 'slug']);
$this->forge->createTable('platforms_temp');
$platformsData = $this->db->table('podcasts_platforms')
->select('podcasts_platforms.*, type')
->join('platforms', 'platforms.slug = podcasts_platforms.platform_slug')
->get()
->getResultArray();
$data = [];
foreach ($platformsData as $platformData) {
$data[] = [
'podcast_id' => $platformData['podcast_id'],
'type' => $platformData['type'],
'slug' => $platformData['platform_slug'],
'link_url' => $platformData['link_url'],
'account_id' => $platformData['account_id'],
'is_visible' => $platformData['is_visible'],
];
}
if ($data !== []) {
$this->db->table('platforms_temp')
->insertBatch($data);
}
$this->forge->dropTable('platforms');
$this->forge->dropTable('podcasts_platforms');
$this->forge->renameTable('platforms_temp', 'platforms');
}
#[Override]
public function down(): void
{
// delete platforms
$this->forge->dropTable('platforms');
// recreate platforms and podcasts_platforms tables
$this->forge->addField([
'slug' => [
'type' => 'VARCHAR',
'constraint' => 32,
],
'type' => [
'type' => 'ENUM',
'constraint' => ['podcasting', 'social', 'funding'],
],
'label' => [
'type' => 'VARCHAR',
'constraint' => 32,
],
'home_url' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'submit_url' => [
'type' => 'VARCHAR',
'constraint' => 512,
'null' => true,
],
]);
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP()');
$this->forge->addField(
'`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()',
);
$this->forge->addPrimaryKey('slug');
$this->forge->createTable('platforms');
$this->forge->addField([
'podcast_id' => [
'type' => 'INT',
'unsigned' => true,
],
'platform_slug' => [
'type' => 'VARCHAR',
'constraint' => 32,
],
'link_url' => [
'type' => 'VARCHAR',
'constraint' => 512,
],
'account_id' => [
'type' => 'VARCHAR',
'constraint' => 128,
'null' => true,
],
'is_visible' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
'is_on_embed' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
]);
$this->forge->addPrimaryKey(['podcast_id', 'platform_slug']);
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
$this->forge->addForeignKey('platform_slug', 'platforms', 'slug', 'CASCADE');
$this->forge->createTable('podcasts_platforms');
}
}
<?php
declare(strict_types=1);
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use Override;
/**
* CodeIgniter 4.5.1 introduces new DataCaster class that breaks deserialization of import queue tasks.
* This just removes them altogether.
*/
class ClearImportQueue extends Migration
{
#[Override]
public function up(): void
{
service('settings')->forget('Import.queue');
}
#[Override]
public function down(): void
{
// nothing
}
}
<?php
declare(strict_types=1);
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddEpisodeDownloadsCount extends Migration
{
public function up(): void
{
$fields = [
'downloads_count' => [
'type' => 'INT',
'unsigned' => true,
'default' => 0,
'after' => 'is_published_on_hubs',
],
];
$this->forge->addColumn('episodes', $fields);
}
public function down(): void
{
$this->forge->dropColumn('episodes', 'downloads_count');
}
}
<?php
declare(strict_types=1);
/**
* Class AddPodcastsMediumField adds medium field to podcast 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;
use Override;
class DropDeprecatedPodcastsFields extends BaseMigration
{
#[Override]
public function up(): void
{
// TODO: migrate data
$this->forge->dropColumn(
'podcasts',
'episode_description_footer_markdown,episode_description_footer_html,is_owner_email_removed_from_feed,medium,payment_pointer,verify_txt,custom_rss,partner_id,partner_link_url,partner_image_url',
);
}
#[Override]
public function down(): void
{
$fields = [
'episode_description_footer_markdown' => [
'type' => 'TEXT',
'null' => true,
],
'episode_description_footer_html' => [
'type' => 'TEXT',
'null' => true,
],
'is_owner_email_removed_from_feed' => [
'type' => 'BOOLEAN',
'null' => false,
'default' => 0,
'after' => 'owner_email',
],
'medium' => [
'type' => "ENUM('podcast','music','audiobook')",
'null' => false,
'default' => 'podcast',
'after' => 'type',
],
'payment_pointer' => [
'type' => 'VARCHAR',
'constraint' => 128,
'comment' => 'Wallet address for Web Monetization payments',
'null' => true,
],
'verify_txt' => [
'type' => 'TEXT',
'null' => true,
'after' => 'location_osm',
],
'custom_rss' => [
'type' => 'JSON',
'null' => true,
],
'partner_id' => [
'type' => 'VARCHAR',
'constraint' => 32,
'null' => true,
],
'partner_link_url' => [
'type' => 'VARCHAR',
'constraint' => 512,
'null' => true,
],
'partner_image_url' => [
'type' => 'VARCHAR',
'constraint' => 512,
'null' => true,
],
];
$this->forge->addColumn('podcasts', $fields);
}
}
<?php
declare(strict_types=1);
/**
* Class AddPodcastsMediumField adds medium field to podcast 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;
use Override;
class DropDeprecatedEpisodesFields extends BaseMigration
{
#[Override]
public function up(): void
{
$this->forge->dropColumn('episodes', 'custom_rss');
}
#[Override]
public function down(): void
{
$fields = [
'custom_rss' => [
'type' => 'JSON',
'null' => true,
],
];
$this->forge->addColumn('episodes', $fields);
}
}
...@@ -14,6 +14,7 @@ namespace App\Database\Migrations; ...@@ -14,6 +14,7 @@ namespace App\Database\Migrations;
use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\BaseConnection;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Override;
class BaseMigration extends Migration class BaseMigration extends Migration
{ {
...@@ -24,10 +25,12 @@ class BaseMigration extends Migration ...@@ -24,10 +25,12 @@ class BaseMigration extends Migration
*/ */
protected $db; protected $db;
#[Override]
public function up(): void public function up(): void
{ {
} }
#[Override]
public function down(): void public function down(): void
{ {
} }
......
...@@ -13,13 +13,14 @@ declare(strict_types=1); ...@@ -13,13 +13,14 @@ declare(strict_types=1);
namespace App\Database\Seeds; namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Override;
class AppSeeder extends Seeder class AppSeeder extends Seeder
{ {
#[Override]
public function run(): void public function run(): void
{ {
$this->call('CategorySeeder'); $this->call('CategorySeeder');
$this->call('LanguageSeeder'); $this->call('LanguageSeeder');
$this->call('PlatformSeeder');
} }
} }
...@@ -13,9 +13,11 @@ declare(strict_types=1); ...@@ -13,9 +13,11 @@ declare(strict_types=1);
namespace App\Database\Seeds; namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Override;
class CategorySeeder extends Seeder class CategorySeeder extends Seeder
{ {
#[Override]
public function run(): void public function run(): void
{ {
$data = [ $data = [
......
...@@ -13,14 +13,15 @@ declare(strict_types=1); ...@@ -13,14 +13,15 @@ declare(strict_types=1);
namespace App\Database\Seeds; namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Override;
class DevSeeder extends Seeder class DevSeeder extends Seeder
{ {
#[Override]
public function run(): void public function run(): void
{ {
$this->call('CategorySeeder'); $this->call('CategorySeeder');
$this->call('LanguageSeeder'); $this->call('LanguageSeeder');
$this->call('PlatformSeeder');
$this->call('DevSuperadminSeeder'); $this->call('DevSuperadminSeeder');
} }
} }
...@@ -15,9 +15,11 @@ namespace App\Database\Seeds; ...@@ -15,9 +15,11 @@ namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use CodeIgniter\Shield\Entities\User; use CodeIgniter\Shield\Entities\User;
use Modules\Auth\Models\UserModel; use Modules\Auth\Models\UserModel;
use Override;
class DevSuperadminSeeder extends Seeder class DevSuperadminSeeder extends Seeder
{ {
#[Override]
public function run(): void public function run(): void
{ {
if ((new UserModel())->where('is_owner', true)->first() instanceof User) { if ((new UserModel())->where('is_owner', true)->first() instanceof User) {
......