SDB101[critical]Destructive
Table dropped
Dropping a table that already exists deletes its data.
Why it's risky in PostgreSQL
DROP TABLE removes the table and every row in it. Running application code that still reads the table will start failing immediately.
Ship the code change that stops using the table first, keep the data for a release, then drop it in a later migration.
What triggers it, and the safer way
DROP TABLE legacy_orders;-- Release 1: stop reading/writing legacy_orders in the app
-- Release 2 (after a backup):
-- shadowdb:allow SDB101 unused since release 41, backup taken
DROP TABLE legacy_orders;Suppress it when you're sure
Put this comment on the line before the statement. The reason is required and shows in the report.
-- shadowdb:allow SDB101 <why this is safe here>Applies to PostgreSQL 14, 15, 16, 17.