impoort stuff!

This commit is contained in:
Lars Behrends
2025-10-24 16:04:34 +02:00
parent 73d8441787
commit 218d0c28c0
17 changed files with 3043 additions and 277 deletions

View File

@@ -0,0 +1,80 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use App\Database\Database;
class AddPlayniteFieldsToGamesTable extends Migration
{
public function up()
{
Database::getCapsule()->schema()->table('games', function ($table) {
// Rich media fields
$table->string('background_image')->nullable()->after('banner_url');
$table->string('cover_image')->nullable()->after('background_image');
$table->string('icon')->nullable()->after('cover_image');
// Multiple entities as JSON (to handle arrays of objects from Playnite)
$table->json('genres_json')->nullable()->after('genre');
$table->json('developers_json')->nullable()->after('developer');
$table->json('publishers_json')->nullable()->after('publisher');
$table->json('tags_json')->nullable()->after('genres_json');
$table->json('features_json')->nullable()->after('tags_json');
$table->json('links_json')->nullable()->after('features_json');
$table->json('series_json')->nullable()->after('links_json');
$table->json('age_ratings_json')->nullable()->after('series_json');
// Playnite-specific statistics
$table->integer('play_count')->default(0)->after('playtime_minutes');
$table->bigInteger('install_size')->nullable()->after('play_count');
$table->string('completion_status')->nullable()->after('completion_percentage');
// Enhanced ratings (from Playnite)
$table->integer('critic_score')->nullable()->after('rating');
$table->integer('community_score')->nullable()->after('critic_score');
$table->integer('user_score')->nullable()->after('community_score');
// Platform-specific identifiers from Playnite
//$table->string('platform_game_id')->nullable()->after('steam_app_id');
// Playnite-specific metadata
$table->timestamp('added_at')->nullable()->after('last_played_at');
$table->timestamp('modified_at')->nullable()->after('added_at');
$table->boolean('is_custom_game')->default(false)->after('is_favorite');
$table->integer('installation_status')->default(0)->after('is_installed');
// Legacy field removal (keeping for backward compatibility)
// These will be replaced by the JSON fields above
});
}
public function down()
{
Database::getCapsule()->schema()->table('games', function ($table) {
$table->dropColumn([
'background_image',
'cover_image',
'icon',
'genres_json',
'developers_json',
'publishers_json',
'tags_json',
'features_json',
'links_json',
'series_json',
'age_ratings_json',
'play_count',
'install_size',
'completion_status',
'critic_score',
'community_score',
'user_score',
'platform_game_id',
'added_at',
'modified_at',
'is_custom_game',
'installation_status'
]);
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use App\Database\Database;
class CreateImportLogsTable extends Migration
{
public function up()
{
Database::getCapsule()->schema()->create('import_logs', function ($table) {
$table->id();
$table->string('import_type'); // 'playnite', 'csv', etc.
$table->enum('status', ['started', 'running', 'completed', 'failed'])->default('started');
$table->integer('total_items')->default(0);
$table->integer('processed_items')->default(0);
$table->integer('imported_items')->default(0);
$table->integer('updated_items')->default(0);
$table->integer('skipped_items')->default(0);
$table->json('errors')->nullable();
$table->text('message')->nullable();
$table->json('file_info')->nullable(); // File name, size, etc.
$table->string('log_file_path')->nullable(); // Path to detailed log file
$table->timestamp('started_at')->nullable();
$table->timestamp('completed_at')->nullable();
$table->timestamps();
$table->index(['import_type', 'status']);
$table->index(['created_at']);
});
}
public function down()
{
Database::getCapsule()->schema()->dropIfExists('import_logs');
}
}