-
Notifications
You must be signed in to change notification settings - Fork 266
Description
Describe the bug
Hello,
This is the error in question:
File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/schemachange/cli.py", line 71, in main
deploy(config=config, session=session)
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/schemachange/deploy.py", line 102, in deploy
script_metadata = versioned_scripts.get(script.name)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
I took a quick peek at the code. It looks like if dry-run and create-change-history-table are both set to true, with CHANGE_HISTORY table not yet created, the code errors when attempting to find a versioned script entry in a dictionary set to None.
To Reproduce
Run schemachange command and make sure:
dry-runis set totruecreate-change-history-tableis set to trueCHANGE_HISTORYtable does not yet exist
Expected behavior
This was caught because of how we have our pipeline set up - where a dry-run deploy runs first, then the true deploy after manual approval.
If an initial "true" deploy should be done prior to doing the dry-run, then the documentation should probably include a disclaimer for dry-run option (unless I missed it).
Otherwise, I'm thinking the fix would be:
Return an empty dictionary for already-applied versioned scripts only if:
dry-runis set totruecreate-change-history-tableis set to trueCHANGE_HISTORYtable does not yet exist
Schemachange
- Version: 4.0.1