foreign-keys.ts — drizzle-orm Source File
Architecture documentation for foreign-keys.ts, a typescript file in the drizzle-orm codebase. 4 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR fab980e5_64f0_d7af_6cbf_9d6014d326a4["foreign-keys.ts"] 17004f28_e6fd_9cb9_4060_89241969160e["index.ts"] fab980e5_64f0_d7af_6cbf_9d6014d326a4 --> 17004f28_e6fd_9cb9_4060_89241969160e 64ae061d_ed9a_c5f9_235a_3f31995a8d54["table.ts"] fab980e5_64f0_d7af_6cbf_9d6014d326a4 --> 64ae061d_ed9a_c5f9_235a_3f31995a8d54 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] fab980e5_64f0_d7af_6cbf_9d6014d326a4 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 05fb227e_0b02_2bf4_175f_8e70216a34a7["table.utils.ts"] fab980e5_64f0_d7af_6cbf_9d6014d326a4 --> 05fb227e_0b02_2bf4_175f_8e70216a34a7 64ae061d_ed9a_c5f9_235a_3f31995a8d54["table.ts"] 64ae061d_ed9a_c5f9_235a_3f31995a8d54 --> fab980e5_64f0_d7af_6cbf_9d6014d326a4 5eb95521_a13c_5ed6_36c8_8869eb8138fc["utils.ts"] 5eb95521_a13c_5ed6_36c8_8869eb8138fc --> fab980e5_64f0_d7af_6cbf_9d6014d326a4 style fab980e5_64f0_d7af_6cbf_9d6014d326a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { entityKind } from '~/entity.ts';
import { TableName } from '~/table.utils.ts';
import type { AnySQLiteColumn, SQLiteColumn } from './columns/index.ts';
import type { SQLiteTable } from './table.ts';
export type UpdateDeleteAction = 'cascade' | 'restrict' | 'no action' | 'set null' | 'set default';
export type Reference = () => {
readonly name?: string;
readonly columns: SQLiteColumn[];
readonly foreignTable: SQLiteTable;
readonly foreignColumns: SQLiteColumn[];
};
export class ForeignKeyBuilder {
static readonly [entityKind]: string = 'SQLiteForeignKeyBuilder';
declare _: {
brand: 'SQLiteForeignKeyBuilder';
foreignTableName: 'TForeignTableName';
};
/** @internal */
reference: Reference;
/** @internal */
_onUpdate: UpdateDeleteAction | undefined;
/** @internal */
_onDelete: UpdateDeleteAction | undefined;
constructor(
config: () => {
name?: string;
columns: SQLiteColumn[];
foreignColumns: SQLiteColumn[];
},
actions?: {
onUpdate?: UpdateDeleteAction;
onDelete?: UpdateDeleteAction;
} | undefined,
) {
this.reference = () => {
const { name, columns, foreignColumns } = config();
return { name, columns, foreignTable: foreignColumns[0]!.table as SQLiteTable, foreignColumns };
};
if (actions) {
this._onUpdate = actions.onUpdate;
this._onDelete = actions.onDelete;
}
}
onUpdate(action: UpdateDeleteAction): this {
this._onUpdate = action;
return this;
}
onDelete(action: UpdateDeleteAction): this {
this._onDelete = action;
return this;
// ... (85 more lines)
Domain
Subdomains
Functions
Classes
Source
Frequently Asked Questions
What does foreign-keys.ts do?
foreign-keys.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in foreign-keys.ts?
foreign-keys.ts defines 2 function(s): SQLiteColumn, foreignKey.
What does foreign-keys.ts depend on?
foreign-keys.ts imports 4 module(s): entity.ts, index.ts, table.ts, table.utils.ts.
What files import foreign-keys.ts?
foreign-keys.ts is imported by 2 file(s): table.ts, utils.ts.
Where is foreign-keys.ts in the architecture?
foreign-keys.ts is located at drizzle-orm/src/sqlite-core/foreign-keys.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/src/sqlite-core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free