Skip to content

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:

Table books {
id bigint [pk, increment]
// dockito-ignore money-float -- the sum of star ratings, not money
rating_total float
}

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.

RuleLevelDialectWhat it catchesFix
no-pkWarningAnya table with no primary keyadd id bigint [pk, increment], or (a, b) [pk]
ref-not-uniqueErrorAnya ref’s key end isn’t a primary key or uniqueadd [unique] on the key end, or ref the table’s key
ref-typeErrorAnya 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-sizeWarningPostgreSQLa foreign key’s integer size differs from its key’sgive the foreign key its key’s type
ref-lengthWarningAnya foreign key’s length or scale differs from its key’sgive the foreign key its key’s length
ref-orderErrorMySQLa composite ref’s key columns are a key in another orderwrite the ref in the key’s order
name-clashErrorPostgreSQL, MySQLtwo names the database keeps in one place, or names that differ only in caserename one of them
reserved-wordWarningPostgreSQL, MySQLa table or column named with a reserved wordrename it (users, app_user)
name-too-longWarning (MySQL: error)PostgreSQL, MySQLa name, or one the SQL makes, past the dialect’s lengthshorten it, or name the index
name-quotesWarningAnya name that must be quoted: spaces, dashes, a leading digit, non-ASCII; in Postgres capitalsrename it in snake_case
unknown-typeWarningPostgreSQL, MySQLa type that isn’t the dialect’s nor an enum in the designuse the dialect’s type
bad-defaultErrorAnya default that doesn’t fit its type or enumgive a default of the column’s type
bad-incrementErrorAnyincrement on a non-integer; in MySQL two in a table, or one off a keymake it an integer key, or drop increment
my-key-too-longErrorMySQLa key on text or blob, or an index past 3,072 bytesuse varchar(191), or index a prefix
RuleLevelDialectWhat it catchesFix
set-null-not-nullWarning (MySQL: error)PostgreSQL, MySQLset null on a not null foreign keydrop not null, or use cascade or restrict
set-defaultWarning (MySQL: error)PostgreSQL, MySQLset default in MySQL, or on a column with no default in Postgresadd a default, or use restrict
one-to-oneWarningAnya one-to-one ref whose foreign key isn’t uniqueadd [unique] on the foreign key, or write >
ref-cycleWarningAnya cycle of not null foreign keysmake one of them nullable
missing-refAdviceAnya column named as another table’s key, with no refadd the ref
orphan-table (off)AdviceAnya table with no refs, in a design of 5 or moreadd a ref to it, or drop it
RuleLevelDialectWhat it catchesFix
fk-no-indexWarningPostgreSQLa foreign key with no index leading with itadd an index on the foreign key
duplicate-indexWarningAnytwo indexes on the same columns, or one on the key’sdrop the extra index
redundant-indexAdviceAnya plain index whose columns lead another indexdrop it: the longer index covers it
wide-pkAdviceAnya key over text, a long varchar, 3+ columns, or (MySQL) a char(36) uuidadd id bigint [pk, increment]; keep the rest [unique]
int-pkAdviceAnyan int key that incrementsmake it bigint
wide-tableAdviceAnya table of more than 60 columnssplit the rarely used columns into a table joined 1-1
RuleLevelDialectWhat it catchesFix
case-style (off)AdviceAnynames mixing snake_case, camelCase and PascalCaserename it as the others
plural-mix (off)AdviceAnytable names mixing plural and singularrename it as the others
pk-name (off)AdviceAnykeys named differently across tablesrename it as the others
fk-name (off)AdviceAnya foreign key that doesn’t name the table it points atrename it to name its table
same-name-typeAdviceAnyone column name with different types across tablesgive it one type
RuleLevelDialectWhat it catchesFix
money-floatWarningAnya float on a money-like columnuse numeric(12,2), or bigint in cents
pg-moneyAdvicePostgreSQLPostgres’s money typeuse numeric(12,2) and a currency column
pg-timestampAdvicePostgreSQLtimestamp without time zoneuse timestamptz
my-timestampAdviceMySQLMySQL’s timestamp, which ends in 2038use datetime, kept in UTC
my-varcharErrorMySQLvarchar with no lengthuse varchar(255), or text
pg-serialAdvicePostgreSQLserial or bigserialwrite bigint [pk, increment]
pg-charAdvicePostgreSQLchar(n), which pads with spacesuse varchar(n) or text
pg-varchar (off)AdvicePostgreSQLvarchar(n) where text would douse text, with a check if a limit matters
enum-bigAdviceAnyan enum of more than 20 values, or (MySQL) used by 4+ tablesmake a lookup table and ref it
RuleLevelDialectWhat it catchesFix
many-to-manyAdviceAnya many-to-many refadd a join table with two > refs
polymorphicAdviceAnya x_type and x_id pair with no refuse a nullable ref a target table, or a join table a target
numbered-columnsAdviceAnycolumns numbered as a list (phone1, phone2)make a table for them
all-nullable (off)AdviceAnyevery column but the key nullableadd not null where a value is required
no-dialectAdviceAnyno database_type on the Project: dialect rules don’t runadd Project { database_type: ‘PostgreSQL’ }
bad-ignoreAdviceAnya dockito-ignore with no reason, or naming no rulewrite // dockito-ignore <rule> — <reason>