mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-14 10:15:46 +00:00

- update .devcontainer settings: remove auto-formatting for php + set intelephense as default formatter - remove prettier php plugin as it lacks php 8 support - add captain hook action for checking style pre-commit - fix style with ecs on all files except views
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class AddEpisodeIdToNotes Adds episode_id field to activitypub_notes 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 AddEpisodeIdToNotes extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$prefix = $this->db->getPrefix();
|
|
|
|
$createQuery = <<<CODE_SAMPLE
|
|
ALTER TABLE {$prefix}activitypub_notes
|
|
ADD COLUMN `episode_id` INT UNSIGNED NULL AFTER `replies_count`,
|
|
ADD FOREIGN KEY {$prefix}activitypub_notes_episode_id_foreign(episode_id) REFERENCES {$prefix}episodes(id) ON DELETE CASCADE;
|
|
CODE_SAMPLE;
|
|
$this->db->query($createQuery);
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->forge->dropForeignKey('activitypub_notes', 'activitypub_notes_episode_id_foreign',);
|
|
$this->forge->dropColumn('activitypub_notes', 'episode_id');
|
|
}
|
|
}
|