Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues getting this tool to run #1

Open
cb109 opened this issue Dec 9, 2022 · 0 comments
Open

Issues getting this tool to run #1

cb109 opened this issue Dec 9, 2022 · 0 comments

Comments

@cb109
Copy link

cb109 commented Dec 9, 2022

  • Django Migration Snapshots version: 0.5.1
  • Django version: 3.2
  • Python version: 3.7.9
  • Operating System: Ubuntu 20.04

Description

I ran into some issues trying to use your tool as documented:

  • The documentation is missing the fact that we need to enable the mechanism first via MIGRATION_SNAPSHOT_MODEL = True
  • MIGRATION_SNAPSHOT_DIR has no effect until we run makemigrations, as you are directly using the value in a FileField upload_to option. Changing the value would require another migration afterwards. I think you can define your FileField upload_to as a module-level function instead that reads from current settings, then no migrations are needed at all, which would be a more intuitive API.
  • Your date commandline argument defaults to the empty string, but will still be passed as date_end to dateutil.parser.parse(), failing with dateutil.parser._parser.ParserError: String does not contain a date:. You should make this optional, handling the empty/None default.
  • If record_snapshot() fails (like with the problem above), you will still try and remove the files that have not been created in the finally: block, which raises a different exception (os.remove(graph_name) FileNotFoundError: [Errno 2] No such file or directory: 'migration_snapshot') and somewhat overshadows any actual underlying issue. Maybe there's a better way to handle this, at least using a more explicit error like failed to create graph file, reason:.
  • Changing DEFAULT_SNAPSHOT_FORMAT had no effect for me, would always try to create a .pdf output file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant