迁移依赖项在db更改后尝试迁移时引用不存在的父节点

2024-06-17 12:23:47 发布

您现在位置:Python中文网/ 问答频道 /正文

以前,我经常为开发和生产(postgresql)保留相同的数据库。这不是一个好主意,所以我这样做是为了让我目前使用的数据库只在生产中使用(我在本地有一个sqlite数据库)

嗯,我尝试迁移生产数据库,并在heroku尝试迁移时对此回溯进行了热处理:

(bosnetvenv) michael@michael-VivoBook-ASUSLaptop-MJ401TA:~/projects/znet/bosnet$ heroku run python manage.py migrate
 ›   Warning: heroku update available from 7.35.0 to 7.38.1.
Running python manage.py migrate on ⬢ zealchain... up, run.1153 (Hobby)
/app/.heroku/python/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 79, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 267, in build_graph
    raise exc
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 241, in build_graph
    self.graph.validate_consistency()
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/graph.py", line 243, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/graph.py", line 243, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/graph.py", line 96, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration engine.0003_auto_20200313_0826 dependencies reference nonexistent parent node ('powerdns_manager', '0007_auto_20200219_0300')

powerdns_manager是我下载的应用程序之外的包。如果您需要查看迁移文件,请告诉我。提前谢谢

编辑:顺便说一句,迁移在本地工作,当我共享同一个数据库时,它们在生产环境中工作


Tags: djangoinfrompyselfappdbheroku