mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-09 04:09:24 +02:00
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Class AddPodcastsCategories Creates podcasts_categories 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 AddPodcastsCategories extends BaseMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$this->forge->addField([
|
|
'podcast_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
],
|
|
'category_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
],
|
|
]);
|
|
$this->forge->addPrimaryKey(['podcast_id', 'category_id']);
|
|
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
|
|
$this->forge->addForeignKey('category_id', 'categories', 'id', '', 'CASCADE');
|
|
$this->forge->createTable('podcasts_categories');
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->forge->dropTable('podcasts_categories');
|
|
}
|
|
}
|