Skip to content

Commit 0831ec6

Browse files
authored
Fix photo ordering on albums (#4685)
1 parent 478c098 commit 0831ec6

8 files changed

Lines changed: 423 additions & 319 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2026 LycheeOrg.
7+
*/
8+
9+
use Illuminate\Database\Migrations\Migration;
10+
11+
return new class() extends Migration {
12+
private const REMOVED_VALUES = ['title_strict', 'description', 'description_strict'];
13+
14+
/**
15+
* Run the migrations.
16+
*/
17+
public function up(): void
18+
{
19+
DB::table('base_albums')
20+
->whereIn('sorting_col', self::REMOVED_VALUES)
21+
->update(['sorting_col' => 'title']);
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
// no coming back.
30+
// Sowwy
31+
}
32+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2026 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+
DB::table('configs')->where('key', 'version')->update(['value' => '070802']);
33+
try {
34+
Artisan::call('cache:clear');
35+
} catch (\Throwable $e) {
36+
$this->msg_section->writeln('<error>Warning:</error> Failed to clear cache for version 7.8.2');
37+
38+
return;
39+
}
40+
$this->msg_section->writeln('<info>Info:</info> Cleared cache for version 7.8.2');
41+
}
42+
43+
/**
44+
* Reverse the migrations.
45+
*
46+
* @return void
47+
*/
48+
public function down(): void
49+
{
50+
DB::table('configs')->where('key', 'version')->update(['value' => '070801']);
51+
}
52+
};

0 commit comments

Comments
 (0)