Database Schema Linting

Photo by Sven Mieke on Unsplash
$ npm install --save-dev schemalint
module.exports = {
connection: {
host: 'localhost',
user: 'postgres',
password: 'postgres',
database: 'acme',
charset: 'utf8',
},

rules: {
'name-casing': ['error', 'snake'],
'name-inflection': ['error', 'singular'],
'prefer-text-to-varchar': ['error'],
},

schemas: [{ name: 'public' }],
};
$ npx schemalint

Lint-driven refactoring: before changing any code, make a linter-rule that outlaws the existing pattern. If possible, make it supply an automatic fix. This beats codemods.

COMMENT ON TABLE "member" IS 'Members of an organization @cached @alias:person'

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store