forge->addField([ 'podcast_id' => [ 'type' => 'INT', 'unsigned' => true, ], 'user_id' => [ 'type' => 'INT', 'unsigned' => true, ], 'group_id' => [ 'type' => 'INT', 'unsigned' => true, ], ]); $this->forge->addPrimaryKey(['user_id', 'podcast_id']); $this->forge->addForeignKey('user_id', 'users', 'id', '', 'CASCADE'); $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE'); $this->forge->addForeignKey('group_id', 'auth_groups', 'id', '', 'CASCADE'); $this->forge->createTable('podcasts_users'); } public function down(): void { $this->forge->dropTable('podcasts_users'); } }