Migrations created in a different (discarded) branch are showing up in master - laravel

I was trying out Passport to learn about it, but wasn't sure I wanted to use it in my project, so I created a new branch called Passport and messed around in there. Passport ended up creating some migrations, which I had run and created the necessary tables.
Eventually I decided, that I didn't want to move forward with it, and used 'git reset --hard' to destroy all changes made. I checked out my master branch again, and got rid of the Passport branch entirely.
I manually deleted any files that were created by Passport which were in .gitignore folders, of this I'm sure. My database migrations folder only has the migrations which I need. So I decided to do a fresh setup of my database once again just to make sure all the junk I put in there during my experiment was cleaned out. I did:
php artisan migrate:reset
composer dump-autoload
php artisan migrate
But for some strange reason, I still get the migrations from the Passport branch and those tables get created as well. I triple checked the migrations folder and none of those migration files are there. I did php artisan migrate:status and can see all those migrations showing up there. I checked the migrations table in the database and it is empty (after running migrate:reset).
Everywhere I've researched, it simply says "Rollback the migration, delete the migration file, run composer dump-autoload to ensure that the migration directory is re-scanned, and then carry on running migrations like you always do".
In a couple of places it also says to run 'php artisan optimize' after dump-autoload, but that command has been removed since 5.4 (https://github.com/laravel/framework/pull/17003)
Would love some help.
Thanks.

Figured it out guys. Basically I needed to run 'composer install' which removed all the extra stuff that had been brought in when I installed Passport.
After doing that, and doing composer dump-autoload, and then doing a fresh migration, it worked.

Related

Laravel Voyager installation issue

I just finished my first laravel project> Now I only need to install an admin panel. I tried to install Laravel Voyager but I got an issue because I had a role table already created, So it stopped the installation. Is there a way to fix this issue or should I use admin panel, what do you advice me ?
I already had a role table with helpers methods and data that I am currently using. I completely unistall it and I delete all files that I got during the installation.
In the past, I run into the same issue with Voyager, with my previous users and a roles table. Since I had logic already in place for the user's/role table design, what I did was fuse both tables migrations into one. In detail these are the steps I went through to accomplish that:
Create new database for Voyager's installation.
Update.env to access new DB (would be advisable to clear cache after).
Install Voyager php artisan voyager:install (after Voyager vendor was installed using composer).
Copy Voyagers migrations to database/migrations, make your changes, turn off the config option database.autoload_migrations (full guidance for this step can be found in https://voyager-docs.devdojo.com/getting-started/installation#advanced).
Merge conflicting migrations files (in this case the roles table, or any other that can conflict with Voyager's migrations), meaning bringing columns needed from the previous migration into Voyager's migration file.
Delete all tables from the database again (since migrations tables were modified) and run php artisan migrate.
Now you should end-up having the previous roles table (with previous and new Voyagers columns, and definitions), without affecting the Voyager's tables functionality :)

My Laravel 5.3 Migrations seem to be messed up - how to fix?

I have a Laravel 5.3 site and I suspect I made some manual database changes without using the Laravel migrate functionality and now it is biting me...
Now I am trying to get to a stable database situation.
Here was my migrations folder yesterday:
create_sometable1_table
create_sometable2_table
create_sometable3_table
And so on.
Then I added via
php artisan make:migration create_newtable_table
But later renamed the migration file and the model file to create_newtabledifferentname_table
Then I tried to add another table using
php artisan make:migration create_anothertable_table
But I get
[InvalidArgumentException]
A CreateAnothertableTable migration already exists.
I ran the usual commands to try and get things into normal state, like cache:clear, and the recommended composer commands (like autoload).
But nothing works.
In my DB these tables don't exist and the migration file create_anothertable_table doesn't exist.
So I ran
php artisan migrate:rollback
And this resulted in all but 3 of my tables disappearing, with 3 now remaining in the database. The 3 remaining ones are not the ones of interest.
Anyway, I have all my tables and data on my live site and am just trying to get things locally looking the same, so no big deal that my DB on localhost is currently messed up.
Just need to know, how to get things into a stable state from this point onward?
Thanks!
Brian

Hesitate to remove utility in my laravel 5.5 project

How about, some time ago I had installed this utility to monitor the query results in my application, now I want to remove it, but I do not know how, someone knows how I can deactivate it?
Welcome to StackOverflow!
That bar at the bottom is called the Laravel Debugbar which is found here: https://github.com/barryvdh/laravel-debugbar
It is controlled by a setting in your .env file in the root of your project called APP_DEBUG. Set this to false to hide the bar (recommended for production).
To uninstall it from your project completely, run composer remove barryvdh/laravel-debugbar. Depending on your Laravel version, you may also have to remove the Service Provider from config/app.php (under providers) or remove it from app/Providers/AppServiceProvider.php depending how you originally installed it.
Note: If you're caching your config (by using php artisan config:cache) then don't forget to clear your config cache after changes by running php artisan config:clear.

How to generate completely new migration in laravel 5.2

I am new to Laravel and was working on one project, which was 90% completed, and now project is 100% completed.
The project has old Migration files. I have made so many modifications in the tables (added/deleted columns) and/or added new tables in the database, now how do I update/create the Migration for that modifications? Because I don't remember where did I made the changes in the tables.
Do I have to use artisan command to create new migration for users table and all other tables same like this? php artisan make:migration create_users_table --create=users or there is any another way?
I have read the documentation but don't get how to do it.
Please correct me if I have made any mistake, because I don't know how to ask this question.
We user migration and tinker to Not use phpmyadmin , so if you have altered your tables in any way in phpmyadmin , you are all set , no need to do anything.
If you dont want to use phpmyadmin you can use migration and then start writing the sql code in there ( altering tables , etc)
And as we know the migration php files are located in your laravelfolder/database/migration . you can edit them there and then run php artisan migration and it will go throw all of them and make the changes in phpmyadmin.
Hope im clear enough :D

Nothing to migrate in Laravel Backpack Package [Laravel 5.4]

I am installing Backpack package in my project, I followed the documentation steps but when I do migrate it says "Nothing to migrate".
I've already tried to publish the migrations but nothing works.
From their documentation, the only thing that you need to migrate is the default users and password reset table that comes with laravel.
php artisan migrate #generates users table (using Laravel's default migrations)
So in case if you've already migrated those, then you can skip that part. But if you haven't then make sure you have the default migrations in database/migrations and then run php artisan migrate:refresh

Resources