|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + * Copyright (c) 2017-2018 Tobias Reich |
| 6 | + * Copyright (c) 2018-2025 LycheeOrg. |
| 7 | + */ |
| 8 | + |
| 9 | +use Illuminate\Database\Migrations\Migration; |
| 10 | +use Illuminate\Support\Facades\Artisan; |
| 11 | +use Illuminate\Support\Facades\DB; |
| 12 | +use Symfony\Component\Console\Output\ConsoleOutput; |
| 13 | +use Symfony\Component\Console\Output\ConsoleSectionOutput; |
| 14 | + |
| 15 | +return new class() extends Migration { |
| 16 | + private ConsoleOutput $output; |
| 17 | + private ConsoleSectionOutput $msg_section; |
| 18 | + |
| 19 | + public function __construct() |
| 20 | + { |
| 21 | + $this->output = new ConsoleOutput(); |
| 22 | + $this->msg_section = $this->output->section(); |
| 23 | + } |
| 24 | + |
| 25 | + /** |
| 26 | + * Run the migrations. |
| 27 | + * |
| 28 | + * @return void |
| 29 | + */ |
| 30 | + public function up(): void |
| 31 | + { |
| 32 | + // Alpha user database is a bit broken on this one. |
| 33 | + // See https://github.com/LycheeOrg/Lychee/pull/3433#discussion_r2165674240 |
| 34 | + DB::table('configs')->where('key', 'user_invitation_ttl')->update(['type_range' => 'positive']); |
| 35 | + |
| 36 | + DB::table('configs')->where('key', 'version')->update(['value' => '060612']); |
| 37 | + Artisan::call('cache:clear'); |
| 38 | + $this->msg_section->writeln('<info>Info:</info> Cleared cache for version 6.6.12'); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Reverse the migrations. |
| 43 | + * |
| 44 | + * @return void |
| 45 | + */ |
| 46 | + public function down(): void |
| 47 | + { |
| 48 | + DB::table('configs')->where('key', 'version')->update(['value' => '060611']); |
| 49 | + } |
| 50 | +}; |
0 commit comments