【发布时间】:2019-10-06 14:22:20
【问题描述】:
我想开始使用具有特定 ID 的应用程序,但当我迁移时出现错误,提示我 dont have permission or does not exist。好吧,我已经是db_owner,所以当我在迁移中执行ALTER SEQUENCE 时,可能会出现错误。
我的项目
myproject/
|-- myproject
|-- dpo/
|-- projeto/
|-- models.py
项目模型.py
class Projeto(models.Model):
..........
所以我做python manage.py makemigrations dpo --empty
然后我去归档并在opererations 添加:migrations.RunSQL('ALTER SEQUENCE dpo_projeto_Projeto_id RESTART WITH 7000;') 我有这个错误Cannot alter the sequence 'dpo_projeto_Projeto_id', because it does not exist or you do not have permission.
【问题讨论】:
-
好吧不是重复的,因为我试过了,但它不起作用
-
然后登录您的数据库控制台并在您的模型上运行 SQL 语句
-
已经尝试过了,我正在创建一个新项目我有这个错误
'Manager' object has no attribute 'create_projeto' -
你如何尝试创建
标签: django django-models django-database