|
@ -63,7 +63,7 @@ class InitController extends Controller { |
|
|
* TODO没有完善 |
|
|
* TODO没有完善 |
|
|
* 清空数据库 |
|
|
* 清空数据库 |
|
|
*/ |
|
|
*/ |
|
|
public function clearDb() { |
|
|
|
|
|
|
|
|
public function actionClearDb() { |
|
|
Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute(); |
|
|
Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute(); |
|
|
$dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1]; |
|
|
$dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1]; |
|
|
$sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';"; |
|
|
$sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';"; |
|
|