Drop all tables in MySQL database

1
2
3
4
5
echo 'show tables;' \
    | python manage.py dbshell \
    | sed -n 2,\$p \
    | awk 'BEGIN {print "set foreign_key_checks=0;"} { print "drop table `" $1 "`;"}' \
    | python manage.py dbshell

More like this

  1. Creating MySQL Alter table commands for Foreign Keys by vidyanand 4 years, 11 months ago
  2. Custom SQL via subquery by drg006 6 years ago
  3. Table Creation Using ORM Standalone by EliAndrewC 5 years, 3 months ago
  4. Managing Google AppEngine datastore maintenance by cvedovini 2 years, 10 months ago
  5. Bulk Insert - updated 5/9/2008 by coolie 5 years, 7 months ago

Comments

(Forgotten your password?)