Giter Site home page Giter Site logo

dbcritic's Introduction

dbcritic

dbcritic finds problems in a database schema.

Synopsis

To run dbcritic, set the environment variables expected by libpq. Then invoke dbcritic with no arguments. For instance:

$ export PGHOST=localhost
$ export PGPORT=5432
$ export PGUSER=myuser
$ export PGDATABASE=mydatabase
$ dbcritic

Building

dbcritic can be build with Nix or without Nix. To build it with Nix, simply invoke nix-build:

$ nix-build

To build it without Nix, first make sure you have installed Idris and libpq. Then invoke make:

$ make

Description

dbcritic connects to a PostgreSQL database using the specified parameters. It then performs a series of checks and reports discovered issues. Issues may result from the cluster configuration or from the database schema.

dbcritic implements the following checks:

Check Description
index_fk_ref Check that foreign key has an index on the referencing side.
primary_key Check that each table has a primary key constraint.
timestamptz Check that columns are of type ‘timestamptz’ rather than of type ‘timestamp’.
time_zone Check that the ‘TimeZone’ parameter is set to a sensible value.

Configuration

dbcritic can be configured with a file .dbcriticrc in the working directory.

dbcritic will ignore any empty lines and comment lines in the file. Comment lines begin with a hash sign (#).

dbcritic can be configured to silence certain issues with silence directives. Any issue whose identifier begins with the given prefix will not be reported. Here is an example of a silence directive:

silence index_fk_ref cache_log

This will silence any issues reported by the index_fk_ref check that pertain to the cache_log table.

Exit status

If any issues were reported, dbcritic exits with status code 1. If an unrecoverable error occurred, dbcritic exits with status code 2. In any other case, dbcritic exits with status code 0.

Bugs

The output is quite verbose and repetitive. Experienced users may favor more compact output. This is currently not implemented.

In the check index_fk_ref, the order of the columns in the suggested index is not always correct.

There are many more opportunities for checks.

dbcritic's People

Contributors

rightfold avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.