Closed agriffin-grow closed 2 months ago
Hi,
I was convinced it was already supported, but it seems not.
A PR with an initial implementation would be appreciated!
@CaselIT https://github.com/sqlalchemy/alembic/pull/1521
Hope that's everything
@CaselIT - do you know when we could expect this to get merged and released?
sorry, been on holiday this past week. Will try taking a look in the weekend
Aaron Griffin has proposed a fix for this issue in the main branch:
Support if_exists and if_not_exists on create/drop table commands https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5455
Describe the use case This is similar to #524, which appears to at least be implemented for indexes.
SqlAlchemy already supports these operations on
DropTable
andCreateTable
so this would essentially be a pass-through in a similar manner.Databases / Backends / Drivers targeted
Postgresql
Example Use Much like drop_index, I'd expect
to produce
Additional context This is just some insurance for edge cases where a migration partially applies due to external circumstances. i.e. a migration containing two drop_table operations could fail after the first succeeds, but then would require some surgery to work again
Have a nice day!