ReferenceIndividual lint rules
Foreign key column names
Configure foreign key column names from resolved targets.
Checks source column names against the referenced table. Missing target evidence produces a coverage gap.
Enable this opt-in rule under lint.rules.
Configuration
import { defineConfig } from '@mwillbanks/zenstack-zenlev'
export default defineConfig({
lint: {
rules: {
'zenlev/naming/foreign-key': ['error', { template: '{targetStem}_id', composite: 'check' }],
},
},
})Parameters
templatedefaults to{targetStem}_idfor single-column foreign keys.irregularmaps singular forms to plural forms.uncountablepreserves the listed forms.compositedefaults toskip. Withcheck, each source column must match the singular target table name followed by_and the corresponding target column.
See the rule overview for naming template variables.
All built-in rules accept the shared selectors.
Example
A single-column reference to customers(id) uses customer_id. A composite reference to customers(region, serial) uses customer_region and customer_serial in that order.