1

I have a migration I'm trying to run. I was able to create it using:

php artisan migrate:make name_of_migration

The files show up properly and everything, but when I try and run

php artisan migrate

I just get a bunch of php spewing out (Looks like one big array/object or something). I left it running for 36 hours and it didn't end so I'm thinking I must have done something wrong. Does anyone have any idea why this might be happening? (I haven't worked with laravel/artisan much so I don't know the ins and outs, such as if there are log files or not, so any advice would be appreciated)


It was recommended I use

php artisan migrate:status

Not only did this spew out an array as before, but it also gave the following:

[InvalidArgumentException]                
Command "migrate:status" is not defined.  
Did you mean one of these?                
  migrate:reset                         
  migrate:refresh                       
  migrate:rollback                      
  migrate:install                       
  migrate                               
  migrate:make                          
  migrate:publish   

Also, It should be noted that I'm using Laravel 4.2 and have inherited this site from someone else. I'm trying to figure out exactly what happened, but it looks like the migration issue might have been around before since even after I deleted the new migration and ran migrate it started spewing php out.

Aram Papazian
  • 2,453
  • 6
  • 38
  • 45
  • Try removing the migration that you created, and then run ```php artisan migrate:status``` and then recreate the migration – Amo Nov 10 '15 at 15:11
  • I tried that and it didn't work. See updated question for what it gave. – Aram Papazian Nov 10 '15 at 15:16
  • @AramPapazian You might want to mention in the future the version of Laravel you're using. Because `migrate:status` exists in Laravel 5, but not in Laravel 4. – Bogdan Nov 10 '15 at 15:18
  • Yeah, Using Laravel 4.2 (was just updating the question with that information) – Aram Papazian Nov 10 '15 at 15:19
  • It would help if you posted your migration code, as well as the output of the `migrate` command. – Bogdan Nov 10 '15 at 15:23
  • I removed the migration code and am just running php artisan migrate on what was there before. It's still spewing out PHP arrays. I'd post the output, but considering it kept spewing out object information for 36 hours last time I think that output might be a little to large to actually post.... It's literally just one big php object that it looks to be outputting. The weird part is that all the migrations are already in the migration table, so I don't know what it's trying to migrate without the new one or why it's not working. – Aram Papazian Nov 10 '15 at 15:33
  • Have you checked the other migrations to see if they have valid code? If you inherited the app, the last person might have left some code that might have no place there (maybe a misplaced/forgotten variable dump). – Bogdan Nov 10 '15 at 15:36
  • There's about 100+ migrations o_O But that's a valid assumption. I'll try and go through and see if I can see anything. But I'd have assumed that artisan wouldn't try to actually load files that it's already processed in a previous attempt no? – Aram Papazian Nov 10 '15 at 15:38
  • Good point, and you're actually right about that. The migrator does exclude any migrations that where ran and registered in the `migrations` table, so my previous suggestion might not be valid. – Bogdan Nov 10 '15 at 15:42
  • Ok, so I went through and did a grep of the files looking for "var_dump" and "print". There weren't any var_dumps in any of the migration files and the only time "print" appeared was in the words "Blueprint". I also looked for "echo", "line", "info", and "error". Only "error" gave back results, but only when creating columns in tables where the column name included "error" – Aram Papazian Nov 10 '15 at 15:45
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/94725/discussion-between-bogdan-and-aram-papazian). – Bogdan Nov 10 '15 at 15:45
  • @AramPapazian Could you post the output that you're seeing a bunch of? Surely that will indicate where it's coming from. – Mikel Bitson Nov 10 '15 at 16:05

2 Answers2

1

So after talking with @Bogdan for a while we figured out it had nothing to do with any of the migrations themselves. There were no output messages in any of the migrations and all of the migrations had been 'completed' but it was still spewing out data. Even when running in pretend mode (php artisan migrate --pretend) we were getting problems.

The code itself was living on an external system which I was VPNing into. When using my local php I was getting the errors, but when I ssh'd into the server itself the problems stopped so we are assuming that it's a PHP version issue. (The server is 5.4 and I'm at 5.5)

Unfortunately, we don't have the time to downgrade my php to test that hypothesis since we did find a workaround, but I figured I'd put it on here in case people want to know. If I do get the time to downgrade php and/or if I find the solution I'll make sure to update this answer with what I did exactly in order to fix the issue.

Major kudos to @Bogdan for all your help. Although he didn't care about the points and so didn't want to answer the question so I can accept it, he spent about an hour or so with me trying to help debug this. So super thanks =)

Aram Papazian
  • 2,453
  • 6
  • 38
  • 45
0

You have to paste us the code/errors that are being printed out when you run php artisan migrate, and also the code inside your migration.

I'm pretty sure your code is not good and you are getting some error. Also migrate:status doesn't exist.

Victor Souto
  • 160
  • 1
  • 6