3

Ok, so this is the problem.

I have a package (deb for debian) that is installing my software in a Linux box. The steps are:

  1. Install the dependencies needed
  2. Copy the PHP source code
  3. Install mysql
  4. Creates a post-install script that will run after the first reboot.
  5. The post install do
    • Creation of user for the database
    • composer install
    • php artisan migrate --force --step

The migrations are like this:

// migration1.php
public function up()
{
    Schema::create('table', function(Blueprint $table) {
        $table->string('field');
    });
}

// migration2.php
public function up()
{
    Schema::table('table', function(Blueprint $table) {
        $table->boolean('another_field');
    });
}

The problem I have is, the database gets stuck on the second migration. It does not show any error, it does not complain, simply it does not work... What is even weird, is if I run the migrations not in the post-inst script, but after sshing into the box, it runs ok: no problems, no stuck...

Any ideas?

Cito
  • 1,659
  • 3
  • 22
  • 49
  • Hi @Cito Did you manage to find a solution for this issue? I am facing the same issue here. – Vikash Agrawal Nov 10 '17 at 08:39
  • Yes @VikashAgrawal, in our case it was a problem with the application. Since we were using python as well to read the database, it was causing it to lock (we are using peewee, so you have to set it to not lock the tables). So we disabled it and it began working as expected. – Cito Nov 10 '17 at 14:22
  • I have the same problem with laravel 5.6 and it's homestead vagrant box. If only .env set to production and I'm using --force directive... it is strange. If only I have seed in it. – Yevgeniy Afanasyev May 22 '18 at 01:25
  • @YevgeniyAfanasyev do you happen to have something else reading your database? In our case it was because another process was locking the tables. – Cito May 22 '18 at 12:24
  • 1
    I created a separate [question](https://stackoverflow.com/questions/50458656/database-gets-stuck-in-migration-with-seeder-on-production-with-force-in-larav) and get the answer already. Thank you. – Yevgeniy Afanasyev May 23 '18 at 01:00

0 Answers0