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

MariaDB: doctrine_migration_versions already exists #550

Open
4d4ch4u32 opened this issue Jun 17, 2024 · 0 comments
Open

MariaDB: doctrine_migration_versions already exists #550

4d4ch4u32 opened this issue Jun 17, 2024 · 0 comments

Comments

@4d4ch4u32
Copy link

4d4ch4u32 commented Jun 17, 2024

I am using the Doctrine migrations bundle in a Docker Compose setup with MariaDB 11.4.

When I run the docker setup, the PHP entry point creates the database if it does not exist after connecting to the database. At this point the migration bundle tries to recreate the doctrine_migration_versions table and I get the error SQLSTATE[42S01]: Base table or view already exists: 1050 table 'doctrine_migration_versions' already exists.

The entrypoint script:

if [ -f ".env.test" ]; then
  echo "Waiting for test database to be ready..."
  if grep -q DATABASE_URL= .env.test; then
    php bin/console doctrine:database:create --env=test --if-not-exists
    if ls -A migrations/*.php >/dev/null 2>&1; then
      php bin/console doctrine:migrations:migrate --no-interaction --env=test
    fi
  else
    echo "The test database is not configured"
    exit 1
  fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant