Skip to content

Instantly share code, notes, and snippets.

@mbischof
Last active October 1, 2023 18:53
Show Gist options
  • Save mbischof/3049758 to your computer and use it in GitHub Desktop.
Save mbischof/3049758 to your computer and use it in GitHub Desktop.
How to drop all tables from database using yii
<?php
$tables = Yii::app()->db->schema->getTableNames();
foreach ($tables as $table) {
Yii::app()->db->createCommand()->dropTable($table);
}
@mbischof
Copy link
Author

oh comments

@pekhota, you're right, that works better
@wade, my code is from old yii 1.1. days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment