File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 6
6
use Doctrine \Deprecations \Deprecation ;
7
7
8
8
use function array_merge ;
9
+ use function count ;
9
10
10
11
/**
11
12
* Differences between two schemas.
@@ -179,6 +180,21 @@ public function getDroppedSequences(): array
179
180
return $ this ->removedSequences ;
180
181
}
181
182
183
+ /**
184
+ * Returns whether the diff is empty (contains no changes).
185
+ */
186
+ public function isEmpty (): bool
187
+ {
188
+ return count ($ this ->newNamespaces ) === 0
189
+ && count ($ this ->removedNamespaces ) === 0
190
+ && count ($ this ->newTables ) === 0
191
+ && count ($ this ->changedTables ) === 0
192
+ && count ($ this ->removedTables ) === 0
193
+ && count ($ this ->newSequences ) === 0
194
+ && count ($ this ->changedSequences ) === 0
195
+ && count ($ this ->removedSequences ) === 0 ;
196
+ }
197
+
182
198
/**
183
199
* The to save sql mode ensures that the following things don't happen:
184
200
*
Original file line number Diff line number Diff line change 14
14
use Doctrine \DBAL \Schema \Comparator ;
15
15
use Doctrine \DBAL \Schema \ForeignKeyConstraint ;
16
16
use Doctrine \DBAL \Schema \Index ;
17
+ use Doctrine \DBAL \Schema \SchemaDiff ;
17
18
use Doctrine \DBAL \Schema \Table ;
18
19
use Doctrine \DBAL \Schema \TableDiff ;
19
20
use Doctrine \DBAL \Schema \UniqueConstraint ;
@@ -1390,6 +1391,14 @@ public function testEmptyTableDiff(): void
1390
1391
self ::assertSame ([], $ this ->platform ->getAlterTableSQL ($ diff ));
1391
1392
}
1392
1393
1394
+ public function testEmptySchemaDiff (): void
1395
+ {
1396
+ $ diff = new SchemaDiff ();
1397
+
1398
+ self ::assertTrue ($ diff ->isEmpty ());
1399
+ self ::assertSame ([], $ this ->platform ->getAlterSchemaSQL ($ diff ));
1400
+ }
1401
+
1393
1402
public function tearDown (): void
1394
1403
{
1395
1404
if (! isset ($ this ->backedUpType )) {
You can’t perform that action at this time.
0 commit comments