12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
|
|
@ -2,21 +2,19 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Article as NewArticle;
|
||||
use App\Models\Brand;
|
||||
use App\Models\Legacy\Presseecho\Article as LegacyArticle;
|
||||
use App\Models\Legacy\Presseecho\User as LegacyUser;
|
||||
// Import der Models für die NEUE Struktur
|
||||
use App\Models\User as NewUser;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
// Import der Models für die ALTE Struktur
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
// Import der Models für die NEUE Struktur
|
||||
use App\Models\User as NewUser;
|
||||
use App\Models\Article as NewArticle;
|
||||
use App\Models\Brand;
|
||||
|
||||
// Import der Models für die ALTE Struktur
|
||||
use App\Models\Legacy\Presseecho\User as LegacyUser;
|
||||
use App\Models\Legacy\Presseecho\Article as LegacyArticle;
|
||||
|
||||
class MigratePresseechoData extends Command
|
||||
class MigratePresseData extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
|
|
@ -41,8 +39,9 @@ class MigratePresseechoData extends Command
|
|||
|
||||
// Holen der Brand-ID für Presseecho aus der neuen DB
|
||||
$brand = Brand::where('domain', 'presseecho.de')->first();
|
||||
if (!$brand) {
|
||||
if (! $brand) {
|
||||
$this->error('Brand "presseecho.de" not found in the new database. Please seed brands first.');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +57,7 @@ class MigratePresseechoData extends Command
|
|||
DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=1;');
|
||||
|
||||
$this->info('Migration for presseecho.de completed successfully!');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ class MigratePresseechoData extends Command
|
|||
// Prüfen, ob der Nutzer (anhand der E-Mail) bereits in der neuen DB existiert
|
||||
$existingUser = NewUser::where('email', $legacyUser->email)->first();
|
||||
|
||||
if (!$existingUser) {
|
||||
if (! $existingUser) {
|
||||
// Nutzer existiert noch nicht -> neu anlegen
|
||||
NewUser::create([
|
||||
'name' => $legacyUser->name,
|
||||
|
|
@ -104,8 +104,9 @@ class MigratePresseechoData extends Command
|
|||
// Den zugehörigen Nutzer in der NEUEN Datenbank finden
|
||||
$author = NewUser::where('email', $legacyArticle->author_email)->first(); // Annahme: Artikel hat eine Autoren-E-Mail
|
||||
|
||||
if (!$author) {
|
||||
if (! $author) {
|
||||
$this->warn("Skipping article ID {$legacyArticle->id}, author with email {$legacyArticle->author_email} not found.");
|
||||
|
||||
continue; // Artikel überspringen, wenn kein Autor gefunden wurde
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue