简体   繁体   中英

Laravel 4 migrate:make not working; just stops after “Compiling views” step

I'm a total newbie following the guestbook tutorial at laravelbook.com, via Koding.com.

In my project directory, running php artisan migrate:make create_entries_table (also tried with --create=entries appended) produces the following response:

Generated migration: blah_blah_blah_create_entries_table  
Compiling common classes  
Compiling views

That's it. No migration table or file is created. Any idea as to why this is happening? I already asked on the L forum yesterday, nobody's responded :( Would really appreciate some insight on this...

UPDATE: Very odd. I ran migrate:reset, and it said Nothing to rollback. But now two migration files are there, from yesterday (one with schema blueprint, one just with blank up & down functions)! No rows in migrations table though.

Other than the migration files not appearing, this is expected behaviour. The migrate:make command only creates the migration file in which you will specify what database actions Laravel is supposed to trigger when migrating (up) or rolling back (down). By default that file will contain a class (which is named by studly-casing the migration name) which up and down methods, nothing more. You might want to use Laravel's Schema class, as per usual, or you might want to do raw queries using the DB class, but you're actually free to put whatever code you want to automate in there (I sometimes run artisan commands in my migrations). Since no error is triggered, I'm assuming Laravel has permission to create files in your database/migrations folder, so it might just be that your app is not refreshing the files view afterwards?

Anyway, in order to actually run the migrations, which will create the migrations table in your database if there isn't one already, is just php artisan migrate . To rollback the last batch of migrations you can use php artisan migrate:rollback and to rollback all batches you use php artisan migrate:reset , but either command is useless if no migration table yet exists, which appeared to be your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM