Every design is checked on each save against these 46 rules. Errors come first, then warnings, then advice, each with its fix. Errors never block a save: the design is kept, and the Problems list shows what to fix.
Rules marked (off) run only when the design turns them on. Dialect rules run when the Project names its database_type.
A comment on a table, column, ref, index or enum ignores a rule there. It needs a reason:
id bigint [pk, increment]
// dockito-ignore money-float -- the sum of star ratings, not money
On the Project, or at the top of the file, it applies to the whole design. dockito-enable turns an off rule on, at its own level or one you give:
// dockito-enable plural-mix warning
Project book_club { database_type: 'PostgreSQL' }
An ignore with no reason, or naming no rule, ignores nothing and shows as bad-ignore. dockito check <design> --ignored lists what’s ignored and why.
Rule Level Dialect What it catches Fix no-pkWarning Any a table with no primary key add id bigint [pk, increment], or (a, b) [pk] ref-not-uniqueError Any a ref’s key end isn’t a primary key or unique add [unique] on the key end, or ref the table’s key ref-typeError Any a foreign key’s type differs in kind from its key’s (in MySQL also integer size or sign) give the foreign key its key’s type ref-int-sizeWarning PostgreSQL a foreign key’s integer size differs from its key’s give the foreign key its key’s type ref-lengthWarning Any a foreign key’s length or scale differs from its key’s give the foreign key its key’s length ref-orderError MySQL a composite ref’s key columns are a key in another order write the ref in the key’s order name-clashError PostgreSQL, MySQL two names the database keeps in one place, or names that differ only in case rename one of them reserved-wordWarning PostgreSQL, MySQL a table or column named with a reserved word rename it (users, app_user) name-too-longWarning (MySQL: error) PostgreSQL, MySQL a name, or one the SQL makes, past the dialect’s length shorten it, or name the index name-quotesWarning Any a name that must be quoted: spaces, dashes, a leading digit, non-ASCII; in Postgres capitals rename it in snake_case unknown-typeWarning PostgreSQL, MySQL a type that isn’t the dialect’s nor an enum in the design use the dialect’s type bad-defaultError Any a default that doesn’t fit its type or enum give a default of the column’s type bad-incrementError Any increment on a non-integer; in MySQL two in a table, or one off a key make it an integer key, or drop increment my-key-too-longError MySQL a key on text or blob, or an index past 3,072 bytes use varchar(191), or index a prefix
Rule Level Dialect What it catches Fix set-null-not-nullWarning (MySQL: error) PostgreSQL, MySQL set null on a not null foreign key drop not null, or use cascade or restrict set-defaultWarning (MySQL: error) PostgreSQL, MySQL set default in MySQL, or on a column with no default in Postgres add a default, or use restrict one-to-oneWarning Any a one-to-one ref whose foreign key isn’t unique add [unique] on the foreign key, or write > ref-cycleWarning Any a cycle of not null foreign keys make one of them nullable missing-refAdvice Any a column named as another table’s key, with no ref add the ref orphan-table (off)Advice Any a table with no refs, in a design of 5 or more add a ref to it, or drop it
Rule Level Dialect What it catches Fix fk-no-indexWarning PostgreSQL a foreign key with no index leading with it add an index on the foreign key duplicate-indexWarning Any two indexes on the same columns, or one on the key’s drop the extra index redundant-indexAdvice Any a plain index whose columns lead another index drop it: the longer index covers it wide-pkAdvice Any a key over text, a long varchar, 3+ columns, or (MySQL) a char(36) uuid add id bigint [pk, increment]; keep the rest [unique] int-pkAdvice Any an int key that increments make it bigint wide-tableAdvice Any a table of more than 60 columns split the rarely used columns into a table joined 1-1
Rule Level Dialect What it catches Fix case-style (off)Advice Any names mixing snake_case, camelCase and PascalCase rename it as the others plural-mix (off)Advice Any table names mixing plural and singular rename it as the others pk-name (off)Advice Any keys named differently across tables rename it as the others fk-name (off)Advice Any a foreign key that doesn’t name the table it points at rename it to name its table same-name-typeAdvice Any one column name with different types across tables give it one type
Rule Level Dialect What it catches Fix money-floatWarning Any a float on a money-like column use numeric(12,2), or bigint in cents pg-moneyAdvice PostgreSQL Postgres’s money type use numeric(12,2) and a currency column pg-timestampAdvice PostgreSQL timestamp without time zone use timestamptz my-timestampAdvice MySQL MySQL’s timestamp, which ends in 2038 use datetime, kept in UTC my-varcharError MySQL varchar with no length use varchar(255), or text pg-serialAdvice PostgreSQL serial or bigserial write bigint [pk, increment] pg-charAdvice PostgreSQL char(n), which pads with spaces use varchar(n) or text pg-varchar (off)Advice PostgreSQL varchar(n) where text would do use text, with a check if a limit matters enum-bigAdvice Any an enum of more than 20 values, or (MySQL) used by 4+ tables make a lookup table and ref it
Rule Level Dialect What it catches Fix many-to-manyAdvice Any a many-to-many ref add a join table with two > refs polymorphicAdvice Any a x_type and x_id pair with no ref use a nullable ref a target table, or a join table a target numbered-columnsAdvice Any columns numbered as a list (phone1, phone2) make a table for them all-nullable (off)Advice Any every column but the key nullable add not null where a value is required no-dialectAdvice Any no database_type on the Project: dialect rules don’t run add Project { database_type: ‘PostgreSQL’ } bad-ignoreAdvice Any a dockito-ignore with no reason, or naming no rule write // dockito-ignore <rule> — <reason>