summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-06-18 21:47:21 -0400
committerSimon Charette <charette.s@gmail.com>2015-06-22 09:35:35 -0400
commit73040e584a9ccc770593a3885f5fe40fda142e0d (patch)
tree7eef638cc54eaa649fef9801795d0cd8b8f3410a /django
parent7f155a07032caf916518beca5b33fa5a90300209 (diff)
Fixed #25002 -- Used PostgreSQL column type alteration USING clause.
Thanks to Dirk Uys for the report.
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/postgresql_psycopg2/schema.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/backends/postgresql_psycopg2/schema.py b/django/db/backends/postgresql_psycopg2/schema.py
index 85d9517c13..bc03a12e8d 100644
--- a/django/db/backends/postgresql_psycopg2/schema.py
+++ b/django/db/backends/postgresql_psycopg2/schema.py
@@ -5,9 +5,12 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
+ sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s"
+
sql_create_sequence = "CREATE SEQUENCE %(sequence)s"
sql_delete_sequence = "DROP SEQUENCE IF EXISTS %(sequence)s CASCADE"
sql_set_sequence_max = "SELECT setval('%(sequence)s', MAX(%(column)s)) FROM %(table)s"
+
sql_create_varchar_index = "CREATE INDEX %(name)s ON %(table)s (%(columns)s varchar_pattern_ops)%(extra)s"
sql_create_text_index = "CREATE INDEX %(name)s ON %(table)s (%(columns)s text_pattern_ops)%(extra)s"