packages/v2/adapter-table-repository-postgres/src/schema/visitors/ARCHITECTURE.md
Declaration: If the folder I belong to changes, please update me, especially core domain concepts. Add examples or example file paths for abstract concepts when needed.
The visitors in this folder are now thin wrappers around the rules system (../rules/).
schemaRuleResolver.upAll(rules, ctx) to generate ADD statementsschemaRuleResolver.downAll(rules, ctx) to generate DROP statementsThis eliminates code duplication between create/delete logic and centralizes schema rule definitions.
ARCHITECTURE.md - Role: folder architecture note; Purpose: describe DDL visitors.PostgresTableSchemaFieldColumn.ts - Role: helper; Purpose: resolve field column names + data types.PostgresTableSchemaFieldCreateVisitor.ts - Role: field visitor; Purpose: delegates to rules system to generate create statements.PostgresTableSchemaFieldDeleteVisitor.ts - Role: field visitor; Purpose: delegates to rules system to generate drop statements.TableSchemaUpdateVisitor.ts - Role: spec visitor; Purpose: delegate field DDL to create/delete visitors during schema updates.See ../rules/ARCHITECTURE.md for details on the schema rules system.
Each field type maps to a set of rules via FieldSchemaRulesFactory. Rules include:
ColumnRule - Standard column creationGeneratedColumnRule - GENERATED ALWAYS AS columnsIndexRule / UniqueIndexRule - IndexesForeignKeyRule - FK constraintsJunctionTableRule - Junction tables for ManyMany/OneWay linksReferenceRule - Reference table entriesThe SchemaRuleResolver handles dependency ordering and batch execution.