|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\Migrations; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\Migrations\Finder\MigrationFinder; |
|
8
|
|
|
use Exception; |
|
9
|
|
|
use function get_class; |
|
10
|
|
|
use function sprintf; |
|
11
|
|
|
|
|
12
|
|
|
class MigrationException extends Exception |
|
13
|
|
|
{ |
|
14
|
1 |
|
public static function migrationsNamespaceRequired() : self |
|
15
|
|
|
{ |
|
16
|
1 |
|
return new self( |
|
17
|
1 |
|
'Migrations namespace must be configured in order to use Doctrine migrations.', |
|
18
|
1 |
|
2 |
|
19
|
|
|
); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
1 |
|
public static function migrationsDirectoryRequired() : self |
|
23
|
|
|
{ |
|
24
|
1 |
|
return new self( |
|
25
|
1 |
|
'Migrations directory must be configured in order to use Doctrine migrations.', |
|
26
|
1 |
|
3 |
|
27
|
|
|
); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
1 |
|
public static function noMigrationsToExecute() : self |
|
31
|
|
|
{ |
|
32
|
1 |
|
return new self( |
|
33
|
1 |
|
'Could not find any migrations to execute.', |
|
34
|
1 |
|
4 |
|
35
|
|
|
); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
3 |
|
public static function unknownMigrationVersion(string $version) : self |
|
39
|
|
|
{ |
|
40
|
3 |
|
return new self( |
|
41
|
3 |
|
sprintf( |
|
42
|
3 |
|
'Could not find migration version %s', |
|
43
|
3 |
|
$version |
|
44
|
|
|
), |
|
45
|
3 |
|
5 |
|
46
|
|
|
); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public static function alreadyAtVersion(string $version) : self |
|
50
|
|
|
{ |
|
51
|
|
|
return new self( |
|
52
|
|
|
sprintf( |
|
53
|
|
|
'Database is already at version %s', |
|
54
|
|
|
$version |
|
55
|
|
|
), |
|
56
|
|
|
6 |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
1 |
|
public static function duplicateMigrationVersion( |
|
61
|
|
|
string $version, |
|
62
|
|
|
string $class |
|
63
|
|
|
) : self { |
|
64
|
1 |
|
return new self( |
|
65
|
1 |
|
sprintf( |
|
66
|
1 |
|
'Migration version %s already registered with class %s', |
|
67
|
1 |
|
$version, |
|
68
|
1 |
|
$class |
|
69
|
|
|
), |
|
70
|
1 |
|
7 |
|
71
|
|
|
); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
4 |
|
public static function configurationFileAlreadyLoaded() : self |
|
75
|
|
|
{ |
|
76
|
4 |
|
return new self( |
|
77
|
4 |
|
sprintf( |
|
78
|
4 |
|
'Migrations configuration file already loaded' |
|
79
|
|
|
), |
|
80
|
4 |
|
8 |
|
81
|
|
|
); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public static function yamlConfigurationNotAvailable() : self |
|
85
|
|
|
{ |
|
86
|
|
|
return new self( |
|
87
|
|
|
'Unable to load yaml configuration files, please run `composer require symfony/yaml` to load yaml configuration files.' |
|
88
|
|
|
); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
8 |
|
public static function configurationIncompatibleWithFinder( |
|
92
|
|
|
string $configurationParameterName, |
|
93
|
|
|
MigrationFinder $finder |
|
94
|
|
|
) : self { |
|
95
|
8 |
|
return new self( |
|
96
|
8 |
|
sprintf( |
|
97
|
8 |
|
'Configuration-parameter "%s" cannot be used with finder of type "%s"', |
|
98
|
8 |
|
$configurationParameterName, |
|
99
|
8 |
|
get_class($finder) |
|
100
|
|
|
), |
|
101
|
8 |
|
9 |
|
102
|
|
|
); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
8 |
|
public static function configurationNotValid(string $message) : self |
|
106
|
|
|
{ |
|
107
|
8 |
|
return new self($message, 10); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
1 |
|
public static function migrationClassNotFound( |
|
111
|
|
|
string $migrationClass, |
|
112
|
|
|
?string $migrationNamespace |
|
113
|
|
|
) : self { |
|
114
|
1 |
|
return new self( |
|
115
|
1 |
|
sprintf( |
|
116
|
1 |
|
'Migration class "%s" was not found. Is it placed in "%s" namespace?', |
|
117
|
1 |
|
$migrationClass, |
|
118
|
1 |
|
$migrationNamespace |
|
119
|
|
|
) |
|
120
|
|
|
); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
1 |
|
public static function migrationNotConvertibleToSql( |
|
124
|
|
|
string $migrationClass |
|
125
|
|
|
) : self { |
|
126
|
1 |
|
return new self( |
|
127
|
1 |
|
sprintf( |
|
128
|
1 |
|
'Migration class "%s" contains a prepared statement. |
|
129
|
|
|
Unfortunately there is no cross platform way of outputing it as an sql string. |
|
130
|
|
|
Do you want to write a PR for it ?', |
|
131
|
1 |
|
$migrationClass |
|
132
|
|
|
) |
|
133
|
|
|
); |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
|