mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-05 18:19:59 -05:00
update: fulfill requests with torrent id instead of info_hash
This commit is contained in:
@@ -23,10 +23,10 @@ class TorrentRequestFactory extends Factory
|
||||
'category_id' => fn () => Category::factory()->create()->id,
|
||||
'type_id' => fn () => Type::factory()->create()->id,
|
||||
'resolution_id' => fn () => Resolution::factory()->create()->id,
|
||||
'imdb' => $this->faker->word(),
|
||||
'tvdb' => $this->faker->word(),
|
||||
'tmdb' => $this->faker->word(),
|
||||
'mal' => $this->faker->word(),
|
||||
'imdb' => $this->faker->randomNumber(),
|
||||
'tvdb' => $this->faker->randomNumber(),
|
||||
'tmdb' => $this->faker->randomNumber(),
|
||||
'mal' => $this->faker->randomNumber(),
|
||||
'igdb' => $this->faker->word(),
|
||||
'description' => $this->faker->text(),
|
||||
'user_id' => fn () => User::factory()->create()->id,
|
||||
@@ -35,7 +35,7 @@ class TorrentRequestFactory extends Factory
|
||||
'claimed' => $this->faker->boolean(),
|
||||
'anon' => $this->faker->boolean(),
|
||||
'filled_by' => fn () => User::factory()->create()->id,
|
||||
'filled_hash' => fn () => Torrent::factory()->create()->id,
|
||||
'torrent_id' => fn () => Torrent::factory()->create()->id,
|
||||
'filled_when' => $this->faker->dateTime(),
|
||||
'filled_anon' => $this->faker->boolean(),
|
||||
'approved_by' => fn () => User::factory()->create()->id,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use App\Models\TorrentRequest;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('requests', function (Blueprint $table) {
|
||||
$table->unsignedInteger('torrent_id')->nullable()->after('filled_hash');
|
||||
|
||||
$table->foreign('torrent_id')->references('id')->on('torrents')->cascadeOnUpdate()->cascadeOnDelete();
|
||||
});
|
||||
|
||||
TorrentRequest::query()
|
||||
->join('torrents', 'requests.filled_hash', 'torrents.info_hash')
|
||||
->update([
|
||||
'torrent_id' => DB::raw('torrents.id'),
|
||||
'updated_at' => DB::raw('requests.updated_at'),
|
||||
]);
|
||||
|
||||
Schema::table('requests', function (Blueprint $table) {
|
||||
$table->dropIndex('filled_hash');
|
||||
$table->dropColumn('filled_hash');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user