以下是该方案:
psql
提示符。 python manage.py shell
或shell_plus
是否可以使用Django内部删除该数据库的列?我知道这在理论上是可能的。
欢迎任何见解。
答案 0 :(得分:2)
它不应该是一个挑战,因为Cezar指出python manage.py dbshell
应该像psql
那样调用提示。
如果没有其他工作,你仍然可以通过它,因为Django允许从shell执行任意(原始)SQL。下面的代码片段应该这样做:
from django.db import connection
cursor = connection.cursor()
cursor.execute("alter table table_name DROP column column_name")