|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace OCA\Music\Migration; |
|
6
|
|
|
|
|
7
|
|
|
use Closure; |
|
8
|
|
|
use OCP\DB\ISchemaWrapper; |
|
9
|
|
|
use OCP\Migration\SimpleMigrationStep; |
|
10
|
|
|
use OCP\Migration\IOutput; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Migrate the DB schema to Music v1.9.0 level from the v1.4.0 level |
|
14
|
|
|
*/ |
|
15
|
|
|
class Version010900Date20230720133000 extends SimpleMigrationStep { |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @param IOutput $output |
|
19
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
20
|
|
|
* @param array $options |
|
21
|
|
|
*/ |
|
22
|
|
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @param IOutput $output |
|
27
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
28
|
|
|
* @param array $options |
|
29
|
|
|
* @return null|ISchemaWrapper |
|
30
|
|
|
*/ |
|
31
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
32
|
|
|
/** @var ISchemaWrapper $schema */ |
|
33
|
|
|
$schema = $schemaClosure(); |
|
34
|
|
|
$this->fixInconsistentIdTypes($schema); |
|
35
|
|
|
return $schema; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param IOutput $output |
|
40
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
41
|
|
|
* @param array $options |
|
42
|
|
|
*/ |
|
43
|
|
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Some of the foreign keys referring to entity IDs have been previously defined as signed |
|
48
|
|
|
* although the referred primary key has always been unsigned. |
|
49
|
|
|
*/ |
|
50
|
|
|
private function fixInconsistentIdTypes(ISchemaWrapper $schema) { |
|
51
|
|
|
$schema->getTable('music_albums')->changeColumn('album_artist_id', ['unsigned' => true]); |
|
|
|
|
|
|
52
|
|
|
$schema->getTable('music_tracks')->changeColumn('artist_id', ['unsigned' => true]) |
|
|
|
|
|
|
53
|
|
|
->changeColumn('album_id', ['unsigned' => true]); |
|
54
|
|
|
$schema->getTable('music_bookmarks')->changeColumn('entry_id', ['unsigned' => true]); |
|
|
|
|
|
|
55
|
|
|
$schema->getTable('music_ampache_users')->changeColumn('id', ['unsigned' => true]); |
|
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
} |
|
59
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.