mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-11 16:55:46 +00:00

- add .editorconfig file - format all files to comply with castopod's coding style - switch parsedown dependency with commonmark library to better follow commonmark spec for markdown - add prettier command to format all project files at once closes #16
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class AddLanguages
|
|
* Creates languages 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 AddUsersPodcasts extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'user_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
],
|
|
'podcast_id' => [
|
|
'type' => 'BIGINT',
|
|
'constraint' => 20,
|
|
'unsigned' => true,
|
|
],
|
|
'group_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
],
|
|
]);
|
|
$this->forge->addPrimaryKey(['user_id', 'podcast_id']);
|
|
$this->forge->addForeignKey('user_id', 'users', 'id');
|
|
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id');
|
|
$this->forge->addForeignKey('group_id', 'auth_groups', 'id');
|
|
$this->forge->createTable('users_podcasts');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('users_podcasts');
|
|
}
|
|
}
|