how to roll back Laravel command - php

I have run the following Laravel command PHP artisan make: migration add_category_id_to_posts but I need to run the following command as well PHP artisan make: migration add_category_id_to_posts --table=posts then I need to roll back the first command and run the second command. then How?

As mentioned by Fatima Mazhit, this command cannot be rolled back.
Simply delete the newly created add_category_id_to_posts migration file and run php artisan make:migration add_category_id_to_posts --table=posts.

You need to delete the earlier created migration manually and run the same command again after making appropriate changes in your migration. Or simply run php artisan migrate:rollback, will do your task.

go to your database/migration/your migration
delete the migration you recently created, and then run the command again like so:
php artisan make:migration add_category_id_to_posts --table=posts.
note: you can rollback your migrations if you migrate your migrations on the command : php artisan migrate then you can rollback by php artisan migrate:rollback

Related

How to properly remove a table from folder migration in laravel? (With artisan command)

when you use comand by example:
php artisan make:migration create_tasks_table --create=tasks
it creates a table file and dependency link inside of file
\vendor\composer\autoload_classmap.php
How I can do something like?
php artisan remove:table:file create_Task_table
No such command exists in artisan console. However, you can either make one such command or just delete the migration and execute the following command in the console.
composer dump-autoload

How do I remove old artisan command from Kernel in Laravel 5

I have created some Command files into my Laravel Application. Laravel version is 5.2. I set command like: get:email in the Command file. Also call the Command file into Kernel.php. After that I can see the artisan command list by typing the command php artisan list. as like as below:
//output
get:email
And I changed the command title get:email to get-bq:email. When I run the command php artisan get-bq:email -- its working nicely. Also I can see the list by typing the command php artisan list::
//output
get-bq:email
Issue / Problem: Both commands are working. But I won't to work with both of them. I have done the following things:
modified command file as well as command
run composer dump-autoload -o
run composer update
remove vendor and storage folder then run composer update again.
Still the old command is working into my system.
What I want: How May I remove my old commands from my Laravel(5.2) application?
Run these commands:
php artisan cache:clear
php artisan config:clear
These commands will clear app cache and config cache and recreate it.
I've had the same problem recently.
Repoeatedly tried
php artisan cache:clear
php artisan config:clear
and the cached Kernal command wouldn't clear.
In desperation i killed the queue worker terminal and restarted the queue with the command
php artisan queue:work
The issue stopped.

How to migrate table in october cms?

When I migrate the table, the php artisan migrate does not work.
Use composer.
Navigate to the root directory of the project. Run,
php artisan october:up
if you want to roalback you can run
php artisan october:down
Be sure to use composer in the project directory
php artisan migrate:refresh php artisan migrate:rollback php artisan migrate --force are some cmd's you could try. I don't know if this helps you otherwise please explain your question a bit more.
Go to the root directory of your project in command prompt and run these commands
To reset the current migrations if there are some php artisan migrate:reset
then run php artisan migrate

Locally trying to run migration with laravel

I 'm tryin to create this table but I get an error from symfony.
php artisan migrate:make create_foobar_table --create --table="foobar_table"
sudo php artisan migrate:make create_foobar_table --create --table="foobar_table"
Error below:
My composer file is up to date with all dependencies resolved from what I see and I'm connected to my mysql remote db. Any ideas?
The syntax for this command is like this:
php artisan migrate:make create_foobar_table --create=foobar_table
You don't need the --table parameter.

Laravel - migrations

I know I can run artisan migrate to execute my created migrations in my local environment, but:
How can I run migrations in a hosting, if I don't have command line? (this also applies to migrate:install command so I can make them available)
You can call it from your application:
Artisan::call('migrate');

Categories