diff --git a/pattern/typical/enum-table.ts b/pattern/typical/enum-table.ts index 4fa3aa36..dee87813 100644 --- a/pattern/typical/enum-table.ts +++ b/pattern/typical/enum-table.ts @@ -4,10 +4,18 @@ import * as SQLa from "../../render/mod.ts"; // deno-lint-ignore no-explicit-any type Any = any; // make it easier on Deno linting +interface ForeignKeyReference { + tableName: string; + columnName: string; + constraints?: string; +} export interface EnumTableDefn { readonly enumTableNature: "text" | "numeric"; readonly seedDML: string | SQLa.SqlTextSupplier[]; + references: { + code: () => ForeignKeyReference; + } } export function isEnumTableDefn( @@ -137,6 +145,14 @@ export function ordinalEnumTable< seedDML: seedRows && seedRows.length > 0 ? seedRows.map((s) => tdrf.insertDML(s as Any)) : `-- no ${tableName} seed rows`, + references: { + code: () => { + return { + tableName: tableName, + columnName: 'code', + }; + } + } }; const td = SQLa.tableDefinition(tableName, columnsShape, tdOptions); return {