|
| 1 | +<?php |
| 2 | + |
| 3 | +use Illuminate\Database\Migrations\Migration; |
| 4 | +use Illuminate\Support\Facades\DB; |
| 5 | + |
| 6 | +return new class extends Migration |
| 7 | +{ |
| 8 | + private const BROKEN_IMAGE_PATTERN = '%seo_codebar.webp%'; |
| 9 | + |
| 10 | + private const LEGACY_IMAGE_PATTERN = '%seo_paperflakes.webp%'; |
| 11 | + |
| 12 | + /** |
| 13 | + * Run the migrations. |
| 14 | + */ |
| 15 | + public function up(): void |
| 16 | + { |
| 17 | + DB::table('pages') |
| 18 | + ->where(function ($query) { |
| 19 | + $query->where('image', 'like', self::BROKEN_IMAGE_PATTERN) |
| 20 | + ->orWhere('image', 'like', self::LEGACY_IMAGE_PATTERN); |
| 21 | + }) |
| 22 | + ->update(['image' => null]); |
| 23 | + |
| 24 | + foreach (['news', 'technologies', 'open_sources'] as $table) { |
| 25 | + DB::table($table) |
| 26 | + ->where(function ($query) { |
| 27 | + $query->where('image', 'like', self::BROKEN_IMAGE_PATTERN) |
| 28 | + ->orWhere('image', 'like', self::LEGACY_IMAGE_PATTERN); |
| 29 | + }) |
| 30 | + ->update(['image' => '']); |
| 31 | + } |
| 32 | + |
| 33 | + $pageDescriptions = [ |
| 34 | + ['key' => 'start.index', 'locale' => 'de_CH', 'description' => 'Wir hören zu, denken konzeptionell und entwickeln nutzerzentrierte Software mit offenen Technologien und Standards.'], |
| 35 | + ['key' => 'about-us.index', 'locale' => 'de_CH', 'description' => 'Lerne codebar solutions AG kennen – dein Schweizer Partner für konzeptionelle Softwareentwicklung mit offenen Technologien.'], |
| 36 | + ['key' => 'services.index', 'locale' => 'de_CH', 'description' => 'Wir hören zu, erarbeiten Konzepte für künftige Nutzer:innen und setzen sie um – von der Idee bis zur Software.'], |
| 37 | + ['key' => 'products.index', 'locale' => 'de_CH', 'description' => 'Nutzerzentrierte Softwarelösungen mit echtem Mehrwert – entwickelt mit offenen Technologien und Standards.'], |
| 38 | + ['key' => 'contact.index', 'locale' => 'de_CH', 'description' => 'Hast du eine innovative Idee? Wir hören zu, verstehen deine Bedürfnisse und erwecken deine Vision zum Leben.'], |
| 39 | + ['key' => 'news.index', 'locale' => 'en_CH', 'description' => 'Latest news and expert insights on software development, open technologies and digital innovation from codebar.'], |
| 40 | + ['key' => 'about-us.index', 'locale' => 'en_CH', 'description' => 'Meet codebar solutions AG – your Swiss partner for conceptual software development with open technologies.'], |
| 41 | + ]; |
| 42 | + |
| 43 | + foreach ($pageDescriptions as $page) { |
| 44 | + DB::table('pages') |
| 45 | + ->where('key', $page['key']) |
| 46 | + ->where('locale', $page['locale']) |
| 47 | + ->update(['description' => $page['description']]); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Reverse the migrations. |
| 53 | + */ |
| 54 | + public function down(): void |
| 55 | + { |
| 56 | + // SEO image and description fixes are not reversed. |
| 57 | + } |
| 58 | +}; |
0 commit comments