Locally trying to run migration with laravel - php

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.

Related

how to roll back Laravel command

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

php artisan migrate - tables not created in phpMyAdmin

I am following this tutorial here https://www.youtube.com/watch?v=Jbt5bEgv_QM and got stuck in the php artisan migrate part because of this issue. I'm not sure if it's compatibility issue or something. I am fairly new to laravel.
Here's the database.php file and .env file.
UPDATE: i managed to perform the migration using the solutions provided by the user PHP. However, i couldn't find the table in my phpMyAdmin. do i need to change mySQL root password for that? i have actually set the password but in .env and database.php files i left it blank because the migration works that way. if i set the actual password in both files, I'd get access denied error.
Here's the migration files...
php artisan migrate:rollback then run php artisan migrate.
If you make changes to your migration files, simply run php artisan migrate:refresh
1)First you have to Create your related Database.
2)Then:php artisan cache:clear
3)Now run php artisan migrate:install

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.

Using Laravel Migrate how can I refresh a single database?

I have 2 databases and I used the following command:
php artisan migrate:refresh
This cleared both databases and rebuilt the tables, however I'd like to do this only for a single database. How can I do this?
Try using the --database option:
php artisan migrare:refresh --database=connectionName
For future reference, you can get help with arguments and options for any Artisan command by running:
php artisan help CommandName

Categories