diff --git a/app/Jobs/ExportSqliteSongJob.php b/app/Jobs/ExportSqliteSongJob.php index 4c75dc5..1132f46 100644 --- a/app/Jobs/ExportSqliteSongJob.php +++ b/app/Jobs/ExportSqliteSongJob.php @@ -31,6 +31,7 @@ class ExportSqliteSongJob implements ShouldQueue public function handle() { + ini_set('memory_limit', '5120M'); $sqlitePath = storage_path('app/database/tempSong.sqlite'); // 確保資料夾存在 @@ -150,6 +151,31 @@ class ExportSqliteSongJob implements ShouldQueue 'updated_at' => now(), ], ], + 'artist_song_library_cache' => [ + 'query' => fn () => DB::table('artist_song')->select('song_id', 'artist_id'), + 'tableSchema' => function (Blueprint $table) { + $table->unsignedBigInteger('song_library_cache_song_id'); + $table->unsignedBigInteger('artist_id'); + $table->primary(['song_library_cache_song_id', 'artist_id']); + }, + 'transformer' => fn ($row) => [ + 'song_library_cache_song_id' => $row->song_id, + 'artist_id' => $row->artist_id, + ], + ], + + 'song_library_cache_song_category' => [ + 'query' => fn () => DB::table('song_song_category')->select('song_id', 'song_category_id'), + 'tableSchema' => function (Blueprint $table) { + $table->unsignedBigInteger('song_library_cache_id'); + $table->unsignedBigInteger('song_category_id'); + $table->primary(['song_library_cache_id', 'song_category_id']); + }, + 'transformer' => fn ($row) => [ + 'song_library_cache_id' => $row->song_id, + 'song_category_id' => $row->song_category_id, + ], + ], ]); DB::purge($connectionName); SendSqliteFileJob::dispatch($sqlitePath, $this->branchId); diff --git a/app/Jobs/ExportSqliteUserJob.php b/app/Jobs/ExportSqliteUserJob.php index 5b28a20..a222b52 100644 --- a/app/Jobs/ExportSqliteUserJob.php +++ b/app/Jobs/ExportSqliteUserJob.php @@ -67,7 +67,6 @@ class ExportSqliteUserJob implements ShouldQueue $table->string('gender')->default('unset'); // 性別 $table->tinyInteger('status')->default(0); // 啟動 $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); $table->rememberToken(); $table->text('api_plain_token')->nullable(); $table->timestamps(); @@ -80,53 +79,13 @@ class ExportSqliteUserJob implements ShouldQueue 'gender' => $user->gender?->value ?? 'unset', 'status' => $user->status, 'email_verified_at' => $user->email_verified_at, - 'password' => $user->password, 'remember_token' => $user->remember_token, 'api_plain_token' => $user->api_plain_token, 'created_at' => $user->created_at, 'updated_at' => $user->updated_at, ], ], - // --- password_reset_tokens --- - 'password_reset_tokens' => [ - 'query' => fn () => DB::table('password_reset_tokens'), - 'tableSchema' => function (Blueprint $table) { - $table->string('email')->index(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }, - 'transformer' => fn ($row) => [ - 'email' => $row->email, - 'token' => $row->token, - 'created_at' => $row->created_at, - ], - ], - // --- personal_access_tokens --- - 'personal_access_tokens' => [ - 'query' => fn () => DB::table('personal_access_tokens'), - 'tableSchema' => 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(); - }, - 'transformer' => fn ($row) => [ - 'id' => $row->id, - 'tokenable_type' => $row->tokenable_type, - 'tokenable_id' => $row->tokenable_id, - 'name' => $row->name, - 'token' => $row->token, - 'abilities' => $row->abilities, - 'last_used_at' => $row->last_used_at, - 'expires_at' => $row->expires_at, - 'created_at' => $row->created_at, - 'updated_at' => $row->updated_at, - ], - ], + // --- roles --- 'roles' => [ 'query' => fn () => DB::table('roles'),