autoschema changes: Create enum db type #113
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These are changes to autoschema to make postgres enum type work
postgres has support for built in enum type which may be preferred to using strings. This provides database validation/enforcement that only valid values can be input as opposed to leaving it to the ent-or data layer.
2 major downsides of postgres enum types:
Luckily,
alembic
added support forautocommit_block
which makes it possible to have a non-transactional block within a migration script.Because of the following recommendation while using
autocommit_block
,transaction_per_migration
flag is now enabled for all migrations:A future option can be provided to disable this. Or the code can be smarter to only use this when we detect an enum type. For now, the default option for all types has been changed to support this.
This includes tests that validates the following:
Test Plan:
python -m pytest -sv
( I have pytest issues so only that way works)