All rules
Safety
postgresql/
Error on `DROP DATABASE` — catastrophic and belongs to an operator workflow.
Why this matters
Database creation/deletion is not a normal migration step. The operation is catastrophic and irreversible; require it to be run from an operator console with explicit confirmation, not from versioned SQL.
Examples
Incorrect
DROP DATABASE archive_2023;Correct
DROP TABLE archive;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-database": "error",
},
},
]; Options
Edit the SQL — only no-drop-database 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-database — plus no-syntax-error as a safety net.