Init
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
36
database/factories/EpisodeFactory.php
Normal file
36
database/factories/EpisodeFactory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Studios;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Episode>
|
||||
*/
|
||||
class EpisodeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
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(),
|
||||
];
|
||||
}
|
||||
}
|
24
database/factories/HentaiFactory.php
Normal file
24
database/factories/HentaiFactory.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Hentai>
|
||||
*/
|
||||
class HentaiFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'slug' => $this->faker->slug,
|
||||
'description' => $this->faker->text(),
|
||||
];
|
||||
}
|
||||
}
|
24
database/factories/StudiosFactory.php
Normal file
24
database/factories/StudiosFactory.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Studios>
|
||||
*/
|
||||
class StudiosFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'slug' => $this->faker->slug,
|
||||
];
|
||||
}
|
||||
}
|
38
database/factories/UserFactory.php
Normal file
38
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
35
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
35
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('username');
|
||||
$table->string('discriminator');
|
||||
$table->string('email')->nullable()->unique();
|
||||
$table->string('avatar')->nullable();
|
||||
$table->boolean('verified');
|
||||
$table->string('locale');
|
||||
$table->boolean('mfa_enabled');
|
||||
$table->string('refresh_token')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
}
|
||||
};
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contact', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
$table->string('subject');
|
||||
$table->text('message');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contact');
|
||||
}
|
||||
};
|
20
database/migrations/2023_01_05_142617_update_users_table.php
Normal file
20
database/migrations/2023_01_05_142617_update_users_table.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
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('users', function (Blueprint $table) {
|
||||
$table->boolean('is_admin')->default(0);
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->json('roles')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('roles');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->rememberToken()->after('refresh_token');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropRememberToken();
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('discord_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('access_token');
|
||||
$table->string('refresh_token');
|
||||
$table->string('token_type');
|
||||
$table->integer('expires_in');
|
||||
$table->timestamp('expires_at');
|
||||
$table->string('scope');
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('discord_access_tokens');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('refresh_token');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('refresh_token')->nullable();
|
||||
});
|
||||
}
|
||||
};
|
42
database/migrations/2023_06_11_062809_update_users_table.php
Normal file
42
database/migrations/2023_06_11_062809_update_users_table.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('global_name')->nullable()->after('username');
|
||||
$table->string('discriminator')->nullable()->change();
|
||||
$table->string('banner')->nullable()->after('verified');
|
||||
$table->string('banner_color')->nullable()->after('banner');
|
||||
$table->string('accent_color')->nullable()->after('banner_color');
|
||||
$table->string('premium_type')->nullable()->after('mfa_enabled');
|
||||
$table->string('public_flags')->nullable()->after('premium_type');
|
||||
$table->boolean('verified')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('global_name');
|
||||
$table->string('discriminator')->change();
|
||||
$table->dropColumn('banner');
|
||||
$table->dropColumn('banner_color');
|
||||
$table->dropColumn('accent_color');
|
||||
$table->dropColumn('premium_type');
|
||||
$table->dropColumn('public_flags');
|
||||
$table->boolean('verified')->change();
|
||||
});
|
||||
}
|
||||
};
|
25
database/migrations/2023_08_10_145324_create_likes_table.php
Normal file
25
database/migrations/2023_08_10_145324_create_likes_table.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('markable_likes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnUpdate()->cascadeOnDelete();
|
||||
$table->morphs('markable');
|
||||
$table->string('value')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('markable_likes');
|
||||
}
|
||||
};
|
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('hentai', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('title_jpn');
|
||||
$table->string('slug');
|
||||
$table->tinyInteger('episodes');
|
||||
$table->text('description');
|
||||
$table->tinyText('duration');
|
||||
$table->tinyText('status');
|
||||
$table->float('score');
|
||||
$table->string('cover_url');
|
||||
$table->integer('studios_id');
|
||||
$table->date('upload_date');
|
||||
$table->date('release_date');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('episode', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('hentai_id');
|
||||
$table->integer('episode');
|
||||
$table->string('url');
|
||||
$table->string('cover_url');
|
||||
$table->tinyText('resolution');
|
||||
$table->bigInteger('view_count')->unsigned()->default(0)->index();
|
||||
$table->string('download_url')->nullable();
|
||||
$table->boolean('legacy_stream')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('studios', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->tinyText('name');
|
||||
$table->tinyText('slug');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('gallery', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('hentai_id');
|
||||
$table->integer('episode_id');
|
||||
$table->string('image_url');
|
||||
$table->string('thumbnail_url');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('popular_weekly', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('episode_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('popular_monthly', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('episode_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('popular_daily', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('episode_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Episode;
|
||||
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;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Change Tagging from Hentai to Episode
|
||||
$hentai = DB::table('hentai')->get();
|
||||
foreach($hentai as $h) {
|
||||
|
||||
$episodes = Episode::where('hentai_id', $h->id)->get();
|
||||
foreach($episodes as $episode) {
|
||||
$episode->tag($h->tagNames());
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Hentai Tags
|
||||
foreach($hentai as $h) {
|
||||
$h->untag();
|
||||
}
|
||||
|
||||
Schema::table('episode', function (Blueprint $table) {
|
||||
$table->string('title')->after('id');
|
||||
$table->string('title_jpn')->after('title');
|
||||
$table->string('slug')->after('title_jpn');
|
||||
$table->integer('studios_id')->after('hentai_id');
|
||||
$table->date('release_date')->nullable()->after('legacy_stream');
|
||||
});
|
||||
|
||||
$episodes = DB::table('episode')->get();
|
||||
foreach($episodes as $episode) {
|
||||
$hentai = Hentai::where('id', $episode->hentai_id)->first();
|
||||
|
||||
$episode->title = $hentai->title;
|
||||
$episode->title_jpn = $hentai->title_jpn;
|
||||
$episode->slug = $hentai->slug.'-'.$episode->episode;
|
||||
$episode->studios_id = $hentai->studios_id;
|
||||
$episode->release_date = Carbon::parse(strval($hentai->release_date).' 01:01:01');
|
||||
|
||||
$alreadyexists = Episode::where('slug', $episode->slug)->first();
|
||||
if ($alreadyexists) {
|
||||
throw new \RuntimeException('Migration stopped! Slug already exists: '.$episode->slug);
|
||||
}
|
||||
|
||||
$episode->save();
|
||||
}
|
||||
|
||||
// Remove
|
||||
Schema::table('hentai', function (Blueprint $table) {
|
||||
$table->dropColumn('title');
|
||||
$table->dropColumn('title_jpn');
|
||||
$table->dropColumn('episodes');
|
||||
$table->dropColumn('duration');
|
||||
$table->dropColumn('status');
|
||||
$table->dropColumn('score');
|
||||
$table->dropColumn('cover_url');
|
||||
$table->dropColumn('studios_id');
|
||||
$table->dropColumn('upload_date');
|
||||
$table->dropColumn('release_date');
|
||||
});
|
||||
}
|
||||
};
|
22
database/migrations/2023_08_12_130605_add_user_settings.php
Normal file
22
database/migrations/2023_08_12_130605_add_user_settings.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// 0 = Cover
|
||||
// 1 = Thumbnail
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('search_design')->default(1);
|
||||
$table->boolean('home_top_design')->default(0);
|
||||
$table->boolean('home_middle_design')->default(1);
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('playlists', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->index();
|
||||
$table->string('name');
|
||||
$table->boolean('is_private')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('playlist_episodes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('position')->nullable();
|
||||
$table->integer('playlist_id')->index();
|
||||
$table->integer('episode_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('playlists');
|
||||
Schema::dropIfExists('playlist_episodes');
|
||||
}
|
||||
};
|
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('alerts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('type');
|
||||
$table->text('text');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('alerts');
|
||||
}
|
||||
};
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('is_patreon')->default(0);
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episode', function (Blueprint $table) {
|
||||
$table->string('download_url_4k')->after('download_url')->nullable();
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$episodes = DB::table('episode')->whereNull('download_url_4k')
|
||||
->where('legacy_stream', 0)
|
||||
->where('resolution', '4k')
|
||||
->get();
|
||||
|
||||
foreach($episodes as $episode) {
|
||||
$episode->download_url_4k = Str::replace('1080p', '2160p', $episode->download_url);
|
||||
$episode->save();
|
||||
}
|
||||
}
|
||||
};
|
32
database/migrations/2023_11_30_150101_create_jobs_table.php
Normal file
32
database/migrations/2023_11_30_150101_create_jobs_table.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('watched', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->index()->constrained()->cascadeOnDelete();
|
||||
$table->integer('episode_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('watched');
|
||||
}
|
||||
};
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->json('tag_blacklist')->nullable();
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episode', function (Blueprint $table) {
|
||||
$table->boolean('interpolated')->default(0)->after('legacy_stream');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('episode', function (Blueprint $table) {
|
||||
$table->dropColumn('interpolated');
|
||||
});
|
||||
}
|
||||
};
|
30
database/migrations/2024_02_18_110521_optimization.php
Normal file
30
database/migrations/2024_02_18_110521_optimization.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('gallery', function (Blueprint $table) {
|
||||
$table->index('hentai_id');
|
||||
$table->index('episode_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('gallery', function (Blueprint $table)
|
||||
{
|
||||
$table->dropIndex(['episode_id', 'hentai_id']);
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('torrents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('hentai_id');
|
||||
$table->string('torrent_url');
|
||||
$table->string('episodes');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('torrents');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('subtitles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->tinyText('name');
|
||||
$table->tinyText('slug');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('subtitles');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('episode_subtitles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('episode_id')->index();
|
||||
$table->foreignId('subtitle_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('episode_subtitles');
|
||||
}
|
||||
};
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episode', function (Blueprint $table) {
|
||||
$table->text('description')->after('episode');
|
||||
});
|
||||
|
||||
DB::statement('UPDATE `episode` INNER JOIN `hentai` ON `episode`.`hentai_id` = `hentai`.`id` SET `episode`.`description` = `hentai`.`description`');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('episode', function (Blueprint $table) {
|
||||
$table->dropColumn('description');
|
||||
});
|
||||
}
|
||||
};
|
17
database/migrations/2024_04_05_145706_rename_tables.php
Normal file
17
database/migrations/2024_04_05_145706_rename_tables.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('contact', 'contacts');
|
||||
Schema::rename('episode', 'episodes');
|
||||
Schema::rename('hentai', 'hentais');
|
||||
}
|
||||
};
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->string('download_url_interpolated')->after('download_url')->nullable();
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('is_banned')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('is_banned');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('legacy_stream');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('resolution');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->boolean('is_dvd_aspect')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('is_dvd_aspect');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Downloads;
|
||||
use App\Models\Episode;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('downloads', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('episode_id')->index()->constrained()->cascadeOnDelete();
|
||||
$table->char('type', 5);
|
||||
$table->string('url');
|
||||
$table->double('size')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Migrate old entries
|
||||
foreach(Episode::all() as $episode) {
|
||||
// 1080p
|
||||
if (! empty($episode->download_url)) {
|
||||
Downloads::create([
|
||||
'episode_id' => $episode->id,
|
||||
'type' => 'FHD',
|
||||
'url' => $episode->download_url
|
||||
]);
|
||||
}
|
||||
|
||||
// 1080p48
|
||||
if (! empty($episode->download_url_interpolated)) {
|
||||
Downloads::create([
|
||||
'episode_id' => $episode->id,
|
||||
'type' => 'FHDi',
|
||||
'url' => $episode->download_url_interpolated
|
||||
]);
|
||||
}
|
||||
|
||||
// 2160p
|
||||
if (! empty($episode->download_url_4k)) {
|
||||
Downloads::create([
|
||||
'episode_id' => $episode->id,
|
||||
'type' => 'UHD',
|
||||
'url' => $episode->download_url_4k
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Drop old entries
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('download_url_interpolated');
|
||||
$table->dropColumn('download_url_4k');
|
||||
$table->dropColumn('download_url');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('downloads');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('downloads', function (Blueprint $table) {
|
||||
$table->bigInteger('count')->after('size')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('downloads', function (Blueprint $table) {
|
||||
$table->dropColumn('count');
|
||||
});
|
||||
}
|
||||
};
|
33
database/migrations/2024_07_30_194424_fix_slugs.php
Normal file
33
database/migrations/2024_07_30_194424_fix_slugs.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Episode;
|
||||
use App\Models\Hentai;
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
foreach (Hentai::all() as $hentai) {
|
||||
$slugParts = explode('-', $hentai->slug);
|
||||
$lastPart = $slugParts[array_key_last($slugParts)];
|
||||
if (is_numeric($lastPart) && $lastPart < 1000) {
|
||||
$slugParts[array_key_last($slugParts)] = 's'.$lastPart;
|
||||
$newSlug = implode('-', $slugParts);
|
||||
|
||||
// Update hentai slug
|
||||
$hentai->slug = $newSlug;
|
||||
$hentai->save();
|
||||
|
||||
// Update episodes related to this hentai in bulk
|
||||
Episode::where('hentai_id', $hentai->id)
|
||||
->update(['slug' => DB::raw("CONCAT('$newSlug-', episode)")]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('downloads_left')->default(5);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('downloads_left');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->string('title_search')->after('title');
|
||||
});
|
||||
|
||||
// Update the title_search field with sanitized titles
|
||||
DB::table('episodes')->update([
|
||||
'title_search' => DB::raw("REGEXP_REPLACE(title, '[^A-Za-z0-9 ]', '')")
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('title_search');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_downloads', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->index();
|
||||
$table->foreignId('episode_id')->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_downloads');
|
||||
}
|
||||
};
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('site_backgrounds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->date('date_start');
|
||||
$table->date('date_end');
|
||||
$table->boolean('default')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('site_backgrounds');
|
||||
}
|
||||
};
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->boolean('interpolated_qhd')->default(0)->after('interpolated');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('interpolated_qhd');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->boolean('interpolated_uhd')->default(0)->after('interpolated');
|
||||
|
||||
// Drop old qhd column
|
||||
$table->dropColumn('interpolated_qhd');
|
||||
});
|
||||
|
||||
Schema::table('user_downloads', function (Blueprint $table) {
|
||||
$table->boolean('interpolated')->default(0)->after('episode_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('episodes', function (Blueprint $table) {
|
||||
$table->dropColumn('interpolated_uhd');
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Playlist;
|
||||
use App\Models\PlaylistEpisode;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Remove duplicates
|
||||
$duplicates = DB::table('playlist_episodes')
|
||||
->select('playlist_id', 'episode_id', DB::raw('MIN(id) as keep_id'))
|
||||
->groupBy('playlist_id', 'episode_id')
|
||||
->havingRaw('COUNT(*) > 1')
|
||||
->get();
|
||||
|
||||
foreach ($duplicates as $dup) {
|
||||
DB::table('playlist_episodes')
|
||||
->where('playlist_id', $dup->playlist_id)
|
||||
->where('episode_id', $dup->episode_id)
|
||||
->where('id', '!=', $dup->keep_id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
// Fix index
|
||||
$playlistIds = Playlist::all()->pluck('id');
|
||||
foreach ($playlistIds as $playlistId) {
|
||||
$episodes = PlaylistEpisode::where('playlist_id', $playlistId)
|
||||
->get();
|
||||
|
||||
foreach ($episodes as $index => $episode) {
|
||||
$episode->position = $index + 1;
|
||||
$episode->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Make entries unique
|
||||
Schema::table('playlist_episodes', function (Blueprint $table) {
|
||||
$table->unique(['playlist_id', 'episode_id']);
|
||||
});
|
||||
}
|
||||
};
|
30
database/migrations/2025_05_30_203455_fix_discord_oauth.php
Normal file
30
database/migrations/2025_05_30_203455_fix_discord_oauth.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('discord_access_tokens', function (Blueprint $table) {
|
||||
$table->string('access_token', 300)->change();
|
||||
$table->string('refresh_token', 300)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('discord_access_tokens', function (Blueprint $table) {
|
||||
$table->string('access_token')->change(); // back to default (255)
|
||||
$table->string('refresh_token')->change(); // back to default (255)
|
||||
});
|
||||
}
|
||||
};
|
19
database/seeders/DatabaseSeeder.php
Normal file
19
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
DeletedUserSeeder::class
|
||||
]);
|
||||
}
|
||||
}
|
50
database/seeders/DeletedUserSeeder.php
Normal file
50
database/seeders/DeletedUserSeeder.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
||||
class DeletedUserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$userexists = User::where('id', '=', 1)->first();
|
||||
|
||||
if (!$userexists) {
|
||||
DB::table('users')->insert([
|
||||
'id' => 1,
|
||||
'username' => 'deleted',
|
||||
'global_name' => 'Deleted User',
|
||||
'discriminator' => null,
|
||||
'email' => 'deleteduser@deleted.com',
|
||||
'avatar' => null,
|
||||
'verified' => null,
|
||||
'banner' => null,
|
||||
'banner_color' => null,
|
||||
'accent_color' => null,
|
||||
'locale' => 'en',
|
||||
'mfa_enabled' => 0,
|
||||
'premium_type' => null,
|
||||
'public_flags' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
'is_admin' => 0,
|
||||
'roles' => null,
|
||||
'search_design' => 1,
|
||||
'home_top_design' => 0,
|
||||
'home_middle_design' => 1,
|
||||
'is_patreon' => 0,
|
||||
'tag_blacklist' => null,
|
||||
'is_banned' => 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user