All rules
Safety
postgresql/
Warn on `DROP SCHEMA ... CASCADE` — removes every object in the schema with no preview.
Why this matters
Same anti-pattern as `DROP TABLE CASCADE` but with a much larger blast radius. Either list the objects you actually want to drop, or drop the schema only when it is already empty.
Examples
Incorrect
DROP SCHEMA staging CASCADE;Correct
DROP SCHEMA staging;DROP SCHEMA staging RESTRICT;Configure it
// eslint.config.js
import postgresql from "eslint-plugin-postgresql";
export default [
{
files: ["**/*.sql"],
languageOptions: {
parser: postgresql.configs.recommended.languageOptions.parser,
},
plugins: { postgresql },
rules: {
"postgresql/no-drop-schema-cascade": "warn",
},
},
]; Options
Edit the SQL — only no-drop-schema-cascade is enabled.
Pre-filled with the first incorrect example. Toggle off in the rule shelf to see how the diagnostic disappears.
Diagnostics
No issues found.
2 rules enabled.
Rule under test
no-drop-schema-cascade — plus no-syntax-error as a safety net.