Skip to content

Commit 61266a4

Browse files
committed
issue #3540 update migration detection
1 parent 1f14ade commit 61266a4

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.github/workflows/database_migration.yaml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
# test the lowest version, to make sure checks pass on it
3939
php-version: ${{ matrix.php-version }}
40-
extensions: json, mbstring, pdo, curl, pdo_sqlite
40+
extensions: json, mbstring, pdo, curl, pdo_mysql
4141
coverage: none
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -63,13 +63,23 @@ jobs:
6363
bin/console doctrine:migrations:diff -n
6464
result=$?
6565
if [ $result -eq 0 ]; then
66-
echo ' '
67-
echo '**************************** CHANGE ****************************'
68-
echo ' '
69-
cat migrations/$(ls -1 migrations | tail -n 1)
70-
echo ' '
71-
echo '********************* MISSING A MIGRATION *********************'
72-
echo ' '
66+
migration_file=migrations/$(ls -1 migrations | tail -n 1)
67+
# The `$this->addSql('ALTER TABLE bolt_field_translation CHANGE value value JSON NOT NULL');` change is due doctrine/migration and database server misconfiguration
68+
count=$(grep -c 'ALTER TABLE bolt_field_translation CHANGE value value JSON NOT NULL' $migration_file || true)
69+
# count all `addSql` method call
70+
countAddSql=$(grep -c 'addSql' $migration_file || true)
71+
if (( $countAddSql - $count > 0 )); then
72+
echo ' '
73+
echo '**************************** CHANGE ****************************'
74+
echo ' '
75+
cat $migration_file
76+
echo ' '
77+
echo '********************* MISSING A MIGRATION *********************'
78+
echo ' '
79+
exit 1
80+
else
81+
echo 'Great Job! No unexpected change!'
82+
fi
7383
fi
7484
exit 0
7585
env:

migrations/Version20201210105836.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public function up(Schema $schema): void
335335
foreach ($fieldTranstationTable->getIndexes() as $index) {
336336
if ($index->getName() === 'bolt_field_translation_unique_translation') {
337337
$fieldTranstationTable->renameIndex('bolt_field_translation_unique_translation',
338-
'field_translation_unique_translation');
338+
'field_translation_unique_translation2');
339339
}
340340
}
341341

0 commit comments

Comments
 (0)