lundi 19 mars 2018

Laravel migrations - Enormous errors in migrating, unable to get rid of migrations previously used

I'm using Laravel 5.6.I created a large number of migration files with class names like "CreateEntitySourcesTable" and "CreateSaintTypesTable" using artisan make:migration create_<table_name>_table. When I ran artisan migrate, it created the most horrible jumble of a mess that it would have taken me more time to try to correct it than it would to just create the tables manually. Specifically what it did was create tables like saint_entity_types and entity_saint_sources when there were no migration files that were even similar. Interestingly, it didn't seem to jumble the fields within the tables if one can guess at the associated table in the migration files.

I thought that maybe it was just too many migrations for Laravel to handle, so I did an artisan migrate:rollback, deleted all tables in the database (including the migrations table), and did a composer dump-autoload. I also looked in vendor/composer/autoload_classmap.php, and there were no Create<table_name>Table references in it. I then moved all the migration files that I had created completely out of my Laravel instance, leaving only the native Laravel user and associated migrations. When I ran artisan migrate, it recreated all the tables including those that I had moved completely out of the database/migrations folder. There doesn't seem to be anything that I can do to prevent artisan from recreating these tables short of completely erasing the Laravel instance and starting all over again.

What I need to know is (a) is there any way to prevent Laravel from creating such a horrible mess of jumbled names when creating and running migrations and (b) is there any way to force artisan to completely forget migrations that it has run and start all over again?

As I said, at this point, I have spent much more time trying to make migrations work than I would have in creating all the tables manually resulting in a severely negative cost-benefit ratio. I have to seriously consider just dumping migrations altogether or dumping Laravel altogether and going back to Yii2 (which worked quite well) if I can't find an expeditious resolution to this stupid problem. I hoping some Laravel guru can point to an easy and obvious workaround!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2u28qzk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire