Why this matters
Roles and credentials belong in an operator-managed bootstrap, not in application migrations that run automatically. Granting privileges to existing roles from a migration is fine.
Examples
Incorrect
CREATE ROLE app_writer LOGIN PASSWORD 'redacted';Correct
GRANT SELECT ON users TO app_reader;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-create-role": "warn",
},
},
]; Options
Edit the SQL — only no-create-role 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-create-role — plus no-syntax-error as a safety net.