0

I have inherited an old legacy system based off Yii 1.1 which has had multiple development teams working on it for the past 10 years so is a bit of a mess with little to no documentation.

Doctrine Migrations have been used in the past and I can get this working on Docker, however on the live EB/EC2 instance, the migrations files will not run from command line.

Command:

php vendor/bin/doctrine-migrations status

Throws error

PHP Warning:  require(/var/app/current/site/vendor/bin/doctrine-migrations.php): failed to open stream: No such file or directory in /var/app/current/site/vendor/bin/doctrine-migrations on line 8 

PHP Fatal error:  require(): Failed opening required '/var/app/current/site/vendor/bin/doctrine-migrations.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /var/app/current/site/vendor/bin/doctrine-migrations on line 8

Looking at my local environment versus the live server, no doctrine-migrations.php file has been created in vendor/bin on the dev server, which composer should have created and is the file being looked for. Composer install is run during build on every deployment but I can't figure out why it is not auto-generating this file in the vendor/bin directory - just another file called doctrine-migrations which pretty much just requires doctrine-migrations.php:

#!/usr/bin/env php
<?php

declare(strict_types=1);

namespace Doctrine\Migrations;

require __DIR__ . '/doctrine-migrations.php';
Nicko Brooko
  • 233
  • 2
  • 11

1 Answers1

0

conposer install install bundle declared in your composer.lock file. Your composer.lock file is generated when doing your first composer install or a composer update or composer require

Difference may occur between your local environment and production environment. Indeed, on local, composer install install some bundle only needed in dev mode (see your require-dev part in composer.json)

Either the composer.lock file is not up to date with your composer.json file (if composer.json contain the required bundle) either the required bundle is set as require-dev

To install it, you can run composer install doctrine/doctrine-migrations-bundle

Florent Cardot
  • 1,400
  • 1
  • 10
  • 19
  • doctrine/migrations is in composer.lock and migrations file appears in the vendor directory on live. Wondering if there was a problem with creation of proxy file in vendor/bin though not really sure where to start with that – Nicko Brooko Dec 08 '21 at 16:09