Lintrule Documentation


    Example: SQL Migrations

    Create a new ruleset in the .rules directory:

    touch .rules/

    Then, add a rule like the following:

    include: ["migrations/*.sql"]
    Make sure our postgres migrations follow these rules:
    1. ensure new tables are at least 3NF (third normal form). If they're not, fail and give an example of what's wrong, assuming the reader does not know terms like "BNCF", "3NF", "BCNF", and so on.
    2. make sure that all tables have a created_at and updated_at
    3. make sure migrations don't have breaking changes. For example, removing a table, removing column, and so on.
       3.1 It's okay to have a breaking change if there's a comment on the migration that explains why it's safe to have that change.
    4. prefer 'uuid' over 'serial' or 'int' for primary keys. Ignore this check if it's primary key made up of two columns.