Change enum on history events to str#1379
Change enum on history events to str#1379samredai wants to merge 2 commits intoDataJunction:mainfrom
Conversation
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
| with op.batch_alter_table("history", schema=None) as batch_op: | ||
| batch_op.alter_column( | ||
| "entity_type", | ||
| existing_type=postgresql.ENUM( |
There was a problem hiding this comment.
Should this also drop the enum types from Postgres? Maybe with something like:
batch_op.execute("DROP TYPE IF EXISTS entitytype")
batch_op.execute("DROP TYPE IF EXISTS activitytype")
| entity_type: Mapped[Optional[EntityType]] = mapped_column( | ||
| Enum(EntityType), | ||
| entity_type: Mapped[Optional[str]] = mapped_column( | ||
| String(20), |
There was a problem hiding this comment.
No reason, I just thought that the postgres default of infinite length seemed unnecessary for what will just be a string representation of an enum value. Should I make this larger? Or maybe don't specify the length at all?
Good idea, let me populate it with enum values locally then run a migration and see what happens to the data. |
|
@samredai is this still on your radar? That seems like a good idea. |
|
@agorajek thanks for the reminder comment. Time was tight this past week but I'll try to do this testing soon and get this in. |
Summary
This changes the enum type for activity type and entity type to a string, only in the database model. This will let us modify/extend the history events in the source code more easily without having to do database migrations.
Test Plan
make checkpassesmake testshows 100% unit test coverageDeployment Plan