一键删除数据库中的所有表 [英] Delete all the tables in database in one shot

查看:73
本文介绍了一键删除数据库中的所有表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在laravel中一次删除数据库中的所有表.

How to delete all the tables in a database in one shot in laravel.

对于迁移,我们使用-

Artisan::call('migrate', ['--force' => true]);

但是要删除所有表,有-

but for deleting all the tables is there any-

谢谢

推荐答案

为什么不使用它:

Artisan::call('migrate:reset', ['--force' => true]);

您还可以在较新的Laravel版本中使用 migrate:fresh .

You can also use migrate:fresh in newer Laravel versions.

migrate:fresh 命令将从数据库中删除所有表,然后执行迁移命令

The migrate:fresh command will drop all tables from the database and then execute the migrate command

https://laravel.com/docs/7.x/migrations

这篇关于一键删除数据库中的所有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆