Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change patch from https://code.djangoproject.com/ticket/5568 to work on modern Django. Add special case for MySQL which has different syntax for DROP INDEX. Add unit tests for the new functionality.
- Loading branch information
Tomasz Rybak
committed
Feb 24, 2013
1 parent
6bbf4e5
commit d7429de
Showing
6 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from __future__ import unicode_literals | ||
|
||
from optparse import make_option | ||
|
||
from django.core.management.base import AppCommand | ||
from django.core.management.sql import sql_destroy_indexes | ||
from django.db import connections, DEFAULT_DB_ALIAS | ||
|
||
class Command(AppCommand): | ||
help = "Prints the DROP INDEX SQL statements for the given model module name(s)." | ||
|
||
option_list = AppCommand.option_list + ( | ||
make_option('--database', action='store', dest='database', | ||
default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' | ||
'SQL for. Defaults to the "default" database.'), | ||
|
||
) | ||
|
||
output_transaction = True | ||
|
||
def handle_app(self, app, **options): | ||
return '\n'.join(sql_destroy_indexes(app, self.style, connections[options.get('database')])) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters