You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When collecting context with management command using the example provided in the documentation, Applying pghistory.0004_auto_20220906_1625 migration fails with IndexError.
It seems all trigger relationed migrations fails with IndexError.
#!/usr/bin/env pythonimportcontextlibimportosimportsysimportpghistoryif__name__=='__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
fromdjango.core.managementimportexecute_from_command_lineiflen(sys.argv) >1andnotsys.argv[1].startswith('runserver'):
# Group history context under the same management command if# we aren't running a server.history_context=pghistory.context(command=sys.argv[1])
else:
history_context=contextlib.ExitStack()
withhistory_context:
execute_from_command_line(sys.argv)
Migration works fine when using default manage.py (without context collection for management command)
I tested on newly created django project and the package versions were as follows.
django-pghistory: v3.1.0
django-pgtrigger: v4.11.0
django: v5.0
psycopg2-binary: v2.9.9
PostgreSQL: v15.3
The text was updated successfully, but these errors were encountered:
Thanks for letting me know! I reproduced this myself and made an issue at #149 that overviews the underlying problem.
This is likely not going to be an issue for people using context tracking in normal usage, but rather when tracking migrate, which could have all sorts of custom SQL. The 0004 migration, for example, has exactly that.
For now, I updated the docs to not include migrate in this code example. Will follow up on the actual underlying fix in a later release.
When collecting context with management command using the example provided in the documentation, Applying
pghistory.0004_auto_20220906_1625
migration fails with IndexError.It seems all trigger relationed migrations fails with IndexError.
Migration works fine when using default manage.py (without context collection for management command)
I tested on newly created django project and the package versions were as follows.
The text was updated successfully, but these errors were encountered: