File tree Expand file tree Collapse file tree 5 files changed +10
-6
lines changed Expand file tree Collapse file tree 5 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,10 @@ You can hook into migration execution by implementing `MigrationExecutor` interf
176
176
Implement `executeQuery()` to run checks or other code before/after each query.
177
177
Interface of this method mimics interface of `Doctrine\DBAL\Connection::executeQuery()`.
178
178
179
+ # ### Alter generated migration SQLs:
180
+ You can implement custom `MigrationAnalyzer` and register it as a service.
181
+ This allows you to alter generated SQLs (e.g. add `ALGORITHM=INSTANT`) and assign them to proper phase.
182
+
179
183
# ### Run all queries within transaction:
180
184
181
185
You can change your template (or a single migration) to extend; `TransactionalMigration`.
Original file line number Diff line number Diff line change 12
12
* - drop statements
13
13
* - reorder statements
14
14
*/
15
- interface MigrationsAnalyzer
15
+ interface MigrationAnalyzer
16
16
{
17
17
18
18
/**
Original file line number Diff line number Diff line change 2
2
3
3
namespace ShipMonk \Doctrine \Migration ;
4
4
5
- class MigrationDefaultAnalyzer implements MigrationsAnalyzer
5
+ class MigrationDefaultAnalyzer implements MigrationAnalyzer
6
6
{
7
7
8
8
/**
Original file line number Diff line number Diff line change @@ -33,14 +33,14 @@ class MigrationService
33
33
34
34
private MigrationVersionProvider $ versionProvider ;
35
35
36
- private MigrationsAnalyzer $ migrationsAnalyzer ;
36
+ private MigrationAnalyzer $ migrationsAnalyzer ;
37
37
38
38
public function __construct (
39
39
EntityManagerInterface $ entityManager ,
40
40
MigrationConfig $ config ,
41
41
?MigrationExecutor $ executor = null ,
42
42
?MigrationVersionProvider $ versionProvider = null ,
43
- ?MigrationsAnalyzer $ migrationsAnalyzer = null
43
+ ?MigrationAnalyzer $ migrationsAnalyzer = null
44
44
)
45
45
{
46
46
$ this ->entityManager = $ entityManager ;
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ public function getNextVersion(): string
179
179
};
180
180
[$ entityManager , $ logger ] = $ this ->createEntityManagerAndLogger ();
181
181
182
- $ statementAnalyser = new class implements MigrationsAnalyzer
182
+ $ statementAnalyser = new class implements MigrationAnalyzer
183
183
{
184
184
185
185
/**
@@ -295,7 +295,7 @@ private function createMigrationService(
295
295
array $ excludedTables = [],
296
296
bool $ transactional = false ,
297
297
?MigrationVersionProvider $ versionProvider = null ,
298
- ?MigrationsAnalyzer $ statementAnalyzer = null
298
+ ?MigrationAnalyzer $ statementAnalyzer = null
299
299
): MigrationService
300
300
{
301
301
$ migrationsDir = $ this ->getMigrationsTestDir ();
You can’t perform that action at this time.
0 commit comments