Creating pre_write_hooks
#1114
Replies: 1 comment 2 replies
-
so first off, for any approach, the way that you can "mark" a column with whatever you want is to use the Column("my_column", Integer, info={"frozen": True}) then the things we do after that will look for that .info in there. Next, when you want to consume that is the issue. the phrase "pre_write_hook" suggests you want to catch these columns during the autogenerate phase. You can do that using process_revision_directives, so this sounds exactly like "pre write". however, when you say "when someone runs a migration, the migration fails", that's a different phase. that means they wrote the migration and they are then running the script. You can intercept actual "running" of things, like a I think what you probably are looking for is the process_revision_directives hook above. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the use case
I'd like to be able to mark certain columns of given tables as "frozen", so that when someone runs a migration dropping or changing those columns, the migration fails.
The project I work on is large and I want to ensure someone from another team doesn't accidentally delete columns my team depends on.
Questions
post_write_hooks
, I couldn't find docs forpre_write_hooks
. Is that feature in the backlog? (Ifpre_write_hooks
exist, I can write a custom one to solve this for myself.)Databases / Backends / Drivers targeted
Postgres
Beta Was this translation helpful? Give feedback.
All reactions