Pint
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Studios;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -18,19 +17,19 @@ class EpisodeFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->title(),
|
||||
'title_search' => $this->faker->title(),
|
||||
'title_jpn' => $this->faker->title(),
|
||||
'slug' => $this->faker->slug,
|
||||
'episode' => $this->faker->randomDigit(),
|
||||
'description' => $this->faker->text(),
|
||||
'url' => $this->faker->url(),
|
||||
'cover_url' => $this->faker->url(),
|
||||
'view_count' => $this->faker->randomNumber(),
|
||||
'interpolated' => $this->faker->boolean(),
|
||||
'interpolated_uhd' => $this->faker->boolean(),
|
||||
'release_date' => $this->faker->date(),
|
||||
'is_dvd_aspect' => $this->faker->boolean(),
|
||||
'title' => $this->faker->title(),
|
||||
'title_search' => $this->faker->title(),
|
||||
'title_jpn' => $this->faker->title(),
|
||||
'slug' => $this->faker->slug,
|
||||
'episode' => $this->faker->randomDigit(),
|
||||
'description' => $this->faker->text(),
|
||||
'url' => $this->faker->url(),
|
||||
'cover_url' => $this->faker->url(),
|
||||
'view_count' => $this->faker->randomNumber(),
|
||||
'interpolated' => $this->faker->boolean(),
|
||||
'interpolated_uhd' => $this->faker->boolean(),
|
||||
'release_date' => $this->faker->date(),
|
||||
'is_dvd_aspect' => $this->faker->boolean(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ class HentaiFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'slug' => $this->faker->slug,
|
||||
'description' => $this->faker->text(),
|
||||
'slug' => $this->faker->slug,
|
||||
'description' => $this->faker->text(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ class StudiosFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'slug' => $this->faker->slug,
|
||||
'name' => $this->faker->company(),
|
||||
'slug' => $this->faker->slug,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@ use App\Models\Hentai;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
@@ -17,16 +17,16 @@ return new class extends Migration
|
||||
{
|
||||
// Change Tagging from Hentai to Episode
|
||||
$hentai = DB::table('hentai')->get();
|
||||
foreach($hentai as $h) {
|
||||
foreach ($hentai as $h) {
|
||||
|
||||
$episodes = Episode::where('hentai_id', $h->id)->get();
|
||||
foreach($episodes as $episode) {
|
||||
foreach ($episodes as $episode) {
|
||||
$episode->tag($h->tagNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Hentai Tags
|
||||
foreach($hentai as $h) {
|
||||
foreach ($hentai as $h) {
|
||||
$h->untag();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ return new class extends Migration
|
||||
});
|
||||
|
||||
$episodes = DB::table('episode')->get();
|
||||
foreach($episodes as $episode) {
|
||||
foreach ($episodes as $episode) {
|
||||
$hentai = Hentai::where('id', $episode->hentai_id)->first();
|
||||
|
||||
$episode->title = $hentai->title;
|
||||
|
||||
@@ -12,11 +12,11 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
$episodes = DB::table('episode')->whereNull('download_url_4k')
|
||||
->where('legacy_stream', 0)
|
||||
->where('resolution', '4k')
|
||||
->get();
|
||||
->where('legacy_stream', 0)
|
||||
->where('resolution', '4k')
|
||||
->get();
|
||||
|
||||
foreach($episodes as $episode) {
|
||||
foreach ($episodes as $episode) {
|
||||
$episode->download_url_4k = Str::replace('1080p', '2160p', $episode->download_url);
|
||||
$episode->save();
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('gallery', function (Blueprint $table)
|
||||
{
|
||||
Schema::table('gallery', function (Blueprint $table) {
|
||||
$table->dropIndex(['episode_id', 'hentai_id']);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
@@ -23,13 +23,13 @@ return new class extends Migration
|
||||
});
|
||||
|
||||
// Migrate old entries
|
||||
foreach(Episode::all() as $episode) {
|
||||
foreach (Episode::all() as $episode) {
|
||||
// 1080p
|
||||
if (! empty($episode->download_url)) {
|
||||
Downloads::create([
|
||||
'episode_id' => $episode->id,
|
||||
'type' => 'FHD',
|
||||
'url' => $episode->download_url
|
||||
'type' => 'FHD',
|
||||
'url' => $episode->download_url,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ return new class extends Migration
|
||||
if (! empty($episode->download_url_interpolated)) {
|
||||
Downloads::create([
|
||||
'episode_id' => $episode->id,
|
||||
'type' => 'FHDi',
|
||||
'url' => $episode->download_url_interpolated
|
||||
'type' => 'FHDi',
|
||||
'url' => $episode->download_url_interpolated,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ return new class extends Migration
|
||||
if (! empty($episode->download_url_4k)) {
|
||||
Downloads::create([
|
||||
'episode_id' => $episode->id,
|
||||
'type' => 'UHD',
|
||||
'url' => $episode->download_url_4k
|
||||
'type' => 'UHD',
|
||||
'url' => $episode->download_url_4k,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
use App\Models\Episode;
|
||||
use App\Models\Hentai;
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -13,10 +12,10 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
foreach (Hentai::all() as $hentai) {
|
||||
foreach (Hentai::all() as $hentai) {
|
||||
$slugParts = explode('-', $hentai->slug);
|
||||
$lastPart = $slugParts[array_key_last($slugParts)];
|
||||
if (is_numeric($lastPart) && $lastPart < 1000) {
|
||||
if (is_numeric($lastPart) && $lastPart < 1000) {
|
||||
$slugParts[array_key_last($slugParts)] = 's'.$lastPart;
|
||||
$newSlug = implode('-', $slugParts);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ return new class extends Migration
|
||||
|
||||
// Update the title_search field with sanitized titles
|
||||
DB::table('episodes')->update([
|
||||
'title_search' => DB::raw("REGEXP_REPLACE(title, '[^A-Za-z0-9 ]', '')")
|
||||
'title_search' => DB::raw("REGEXP_REPLACE(title, '[^A-Za-z0-9 ]', '')"),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use App\Models\Playlist;
|
||||
use App\Models\PlaylistEpisode;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Downloads;
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
@@ -14,10 +13,10 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
# Delete entries with "#" as URL
|
||||
// Delete entries with "#" as URL
|
||||
Downloads::where('url', '#')->delete();
|
||||
|
||||
# Remove duplicate entries
|
||||
// Remove duplicate entries
|
||||
$duplicates = DB::table('downloads')
|
||||
->select('episode_id', 'type', DB::raw('COUNT(*) as count'))
|
||||
->groupBy('episode_id', 'type')
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
|
||||
@@ -46,7 +46,6 @@ return new class extends Migration
|
||||
$table->rememberToken()->after('password');
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* Fix Discord Profile Pictures
|
||||
@@ -54,8 +53,7 @@ return new class extends Migration
|
||||
* The oauth package by socialite now returns a full url of the avatar.
|
||||
* Meaning all the old entries have to be fixed.
|
||||
*/
|
||||
foreach (User::whereNotNull('discord_avatar')->get() as $user)
|
||||
{
|
||||
foreach (User::whereNotNull('discord_avatar')->get() as $user) {
|
||||
$isGif = preg_match('/a_.+/m', $user->discord_avatar) === 1;
|
||||
$extension = $isGif ? 'gif' : 'webp';
|
||||
$user->discord_avatar = sprintf('https://cdn.discordapp.com/avatars/%s/%s.%s', $user->id, $user->discord_avatar, $extension);
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
use App\Models\Playlist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
@@ -136,7 +136,7 @@ return new class extends Migration
|
||||
}
|
||||
|
||||
/**
|
||||
* Due to incorrect handling of user deletes,
|
||||
* Due to incorrect handling of user deletes,
|
||||
* we have unreferenced data
|
||||
*/
|
||||
private function deleteUnreferencedData(): void
|
||||
@@ -150,7 +150,7 @@ return new class extends Migration
|
||||
$playlists = Playlist::where('user_id', '>', 1_000_000)
|
||||
->get();
|
||||
|
||||
foreach($playlists as $playlist) {
|
||||
foreach ($playlists as $playlist) {
|
||||
DB::table('playlist_episodes')
|
||||
->where('playlist_id', '=', $playlist->id)
|
||||
->delete();
|
||||
|
||||
@@ -69,7 +69,7 @@ return new class extends Migration
|
||||
// Re-Add foreign key constraint and index
|
||||
Schema::table('comments', function (Blueprint $table) {
|
||||
$table->foreign('child_id')->references('id')->on('comments')->onDelete('cascade');
|
||||
$table->index(["commenter_id", "commenter_type"]);
|
||||
$table->index(['commenter_id', 'commenter_type']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,8 +13,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('locale', 10)
|
||||
->nullable()
|
||||
->after('discord_avatar');
|
||||
->nullable()
|
||||
->after('discord_avatar');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ return new class extends Migration
|
||||
{
|
||||
// Migrate supporters
|
||||
DB::table('users')->where('is_patreon', 1)->update([
|
||||
'roles' => DB::raw("JSON_ARRAY('supporter')")
|
||||
'roles' => DB::raw("JSON_ARRAY('supporter')"),
|
||||
]);
|
||||
|
||||
// Migrate banned
|
||||
DB::table('users')->where('is_banned', 1)->update([
|
||||
'roles' => DB::raw("JSON_ARRAY('banned')")
|
||||
'roles' => DB::raw("JSON_ARRAY('banned')"),
|
||||
]);
|
||||
|
||||
// Migrate admins
|
||||
DB::table('users')->where('is_admin', 1)->update([
|
||||
'roles' => DB::raw("JSON_ARRAY('admin')")
|
||||
'roles' => DB::raw("JSON_ARRAY('admin')"),
|
||||
]);
|
||||
|
||||
// Drop columns
|
||||
|
||||
@@ -13,8 +13,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('matrix_id')
|
||||
->nullable()
|
||||
->after('discord_id');
|
||||
->nullable()
|
||||
->after('discord_id');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class DatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
DeletedUserSeeder::class
|
||||
DeletedUserSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
||||
class DeletedUserSeeder extends Seeder
|
||||
{
|
||||
@@ -18,7 +16,7 @@ class DeletedUserSeeder extends Seeder
|
||||
{
|
||||
$userexists = User::where('id', '=', 1)->first();
|
||||
|
||||
if (!$userexists) {
|
||||
if (! $userexists) {
|
||||
DB::table('users')->insert([
|
||||
'id' => 1,
|
||||
'username' => 'deleted',
|
||||
|
||||
Reference in New Issue
Block a user