清理 django 数据库中以前的表

发布于 2024-12-16 19:55:53 字数 126 浏览 3 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小伙你站住 2024-12-23 19:55:53

最简单的方法是直接在数据库提示符中执行 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 database

倾城泪 2024-12-23 19:55:53

dropdb --help

在终端中运行此命令

dropdb --help

Run this in the terminal

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文