I am doing a project in php Laravel. I am beginner. Accidently I have deleted a table in sql in phpmyadmin.
Now how to recreate that table from php. Not by using sql command.
I am doing a project in php Laravel. I am beginner. Accidently I have deleted a table in sql in phpmyadmin.
Now how to recreate that table from php. Not by using sql command.
2
Answers
from the command line type
php artisan migrate:fresh --seed
however please be advised this will also delete any data in your database.There is no way to restore the data you have deleted
If you want to create the table without data, I can give you a simple solution for your problem
Usually, when you do the migration, the Laravel will compare the list of files between
migrations
table and/database/migrations
folder, if a file exists on the folder and not entered onmigrations
table then it’ll execute the file and make the entry.So, find the migration file name which creates your table on
migrations
table and deletes that row from the database, run the commandphp artisan migrate
this will create the new table
Note: We don’t prefer this mostly, but for your problem, it’ll be simple