清理 django 数据库中以前的表
我在 Postgres 中有一个名为 user 的表,它是一个自定义模型。然后我切换到默认的 Django User 类,但由于名称重叠而出现了问题。我怎样才能擦除以前的表,或者擦除整个数据库(仍在测试中,所以没什么大不了的)以重新开始?
I had a table in Postgres called user that was a custom model. I then switched over to the default Django User class, but there have been issues because of the name overlap. How can I either wipe the previous table, or wipe the entire DB (still in testing, so not a big deal) to start over?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是直接在数据库提示符中执行 DROP TABLE 语句,请记住 Django 模型就像数据库的任何其他表一样
The simplest would be to execute a
DROP TABLE
statement directly in your database prompt, remember that Django models are just like any other table for your databasedropdb --help
在终端中运行此命令
dropdb --help
Run this in the terminal