Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations DOWN (Symfony 7.2) #3

Closed
mathiasstocker opened this issue Jan 27, 2025 · 3 comments
Closed

Migrations DOWN (Symfony 7.2) #3

mathiasstocker opened this issue Jan 27, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@mathiasstocker
Copy link

It seems that the sensor for migrations does not work correctly in some cases (Project with PHP 8.3 and Symfony 7.2):

php8.3 bin/console doctrine:migrations:list

+------------------------------------------+----------+---------------------+----------------+-------------+
| Migration Versions                                                                         |             |
+------------------------------------------+----------+---------------------+----------------+-------------+
| Migration                                | Status   | Migrated At         | Execution Time | Description |
+------------------------------------------+----------+---------------------+----------------+-------------+
| DoctrineMigrations\Version20230313083031 | migrated | 2023-03-30 10:08:30 | 0.034s         |             |
| DoctrineMigrations\Version20230316082648 | migrated | 2023-03-30 10:08:30 | 0.002s         |             |
| DoctrineMigrations\Version20230322153006 | migrated | 2023-03-30 10:08:30 | 0.001s         |             |
+------------------------------------------+----------+---------------------+----------------+-------------+

Health endpoint output:

doctrine-migrations: {
    status: "DOWN",
    details: {
        executed: 0,
        executed unavailable: 0,
        available: 3,
        new: 3
},
error: "Not all migrations were executed"
@mathiasstocker mathiasstocker added the bug Something isn't working label Jan 27, 2025
@mathiasstocker
Copy link
Author

mathiasstocker commented Jan 27, 2025

MetaDataStorage::isInitialized is false:

[Doctrine\Migrations\Metadata\Storage\TableMetadataStorage](file:///home/mastocker/Code/UB/access/vendor/doctrine/migrations/src/Metadata/Storage/TableMetadataStorage.php#L38) {#647 ▼
  -isInitialized: false
  -schemaUpToDate: false
  -schemaManager: 
Doctrine\DBAL\Schema
\
PostgreSQLSchemaManager {#707 ▶}
  -platform: 
Doctrine\DBAL\Platforms
\
PostgreSQL120Platform {[#704 ▶](https://localhost:8000/_actuator/health#sf-dump-1729093748-ref2704)}
  -configuration: 
Doctrine\Migrations\Metadata\Storage
\
TableMetadataStorageConfiguration {#637 ▶}
  -connection: 
Doctrine\DBAL
\
Connection {[#626 ▶](https://localhost:8000/_actuator/health#sf-dump-1729093748-ref2626)}
  -comparator: 
Doctrine\Migrations\Version
\
AlphabeticalComparator {#705}
  -migrationRepository: 
Doctrine\Migrations
\
FilesystemMigrationsRepository {#706 ▶}
}

But the MetaDataStorage is initialized and MetaDataStorage::ensureInitialized() throws an exception when executed at this point:

An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "doctrine_migration_versions" already exists

@mathiasstocker
Copy link
Author

See https://github.com/mathiasstocker/symsensor-migrations-bug on how to reproduce the bug.

@kreemer
Copy link
Contributor

kreemer commented Feb 19, 2025

Tested with version doctrine-migrations-bundle 3.4.1 and works from my side
see https://github.com/doctrine/DoctrineMigrationsBundle/releases/tag/3.4.1

@kreemer kreemer closed this as completed Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants