remove monkey patch

This commit is contained in:
j 2020-05-30 02:27:36 +02:00
parent fc18eecaf4
commit 6217fb774f
2 changed files with 0 additions and 17 deletions

View file

@ -31,19 +31,4 @@ def monkey_patch_username():
if isinstance(v, MaxLengthValidator): if isinstance(v, MaxLengthValidator):
v.limit_value = 255 v.limit_value = 255
def apply_patch():
from django.db import connection, transaction
cursor = connection.cursor()
table = connection.introspection.get_table_description(cursor, User._meta.db_table)
sql = []
for row in table:
if row.name in NEW_LENGTH and row.internal_size != NEW_LENGTH[row.name]:
sql.append('ALTER TABLE "%s" ALTER "%s" TYPE varchar(%d)' % (User._meta.db_table, row.name, NEW_LENGTH[row.name]))
for q in sql:
cursor.execute(q)
if sql:
transaction.commit()
monkey_patch_username() monkey_patch_username()

View file

@ -30,8 +30,6 @@ class Command(BaseCommand):
print(sql) print(sql)
cursor.execute(sql) cursor.execute(sql)
app.monkey_patch.apply_patch()
if settings.DB_GIN_TRGM: if settings.DB_GIN_TRGM:
import entity.models import entity.models
import document.models import document.models