Skip to main content
Module

x/typeorm/src/index.ts>NamingStrategyInterface

Forked from https://github.com/typeorm/typeorm
Latest
interface NamingStrategyInterface
import { type NamingStrategyInterface } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/index.ts";

Naming strategy defines how auto-generated names for such things like table name, or table column gonna be generated.

Properties

optional
name: string

Naming strategy name.

Methods

tableName(targetName: string, userSpecifiedName: string | undefined): string

Normalizes table name.

closureJunctionTableName(originalClosureTableName: string): string

Creates a table name for a junction table of a closure table.

columnName(
propertyName: string,
customName: string | undefined,
embeddedPrefixes: string[],
): string

Gets the table's column name from the given property name.

relationName(propertyName: string): string

Gets the table's relation name from the given property name.

primaryKeyName(tableOrName: Table | string, columnNames: string[]): string

Gets the table's primary key name from the given table name and column names.

uniqueConstraintName(tableOrName: Table | string, columnNames: string[]): string

Gets the table's unique constraint name from the given table name and column names.

relationConstraintName(
tableOrName: Table | string,
columnNames: string[],
where?: string,
): string

Gets the relation constraint (UNIQUE or UNIQUE INDEX) name from the given table name, column names and WHERE condition, if UNIQUE INDEX used.

defaultConstraintName(tableOrName: Table | string, columnName: string): string

Gets the table's default constraint name from the given table name and column name.

foreignKeyName(
tableOrName: Table | string,
columnNames: string[],
referencedTablePath?: string,
referencedColumnNames?: string[],
): string

Gets the name of the foreign key.

indexName(
tableOrName: Table | string,
columns: string[],
where?: string,
): string

Gets the name of the index - simple and compose index.

checkConstraintName(tableOrName: Table | string, expression: string): string

Gets the name of the check constraint.

exclusionConstraintName(tableOrName: Table | string, expression: string): string

Gets the name of the exclusion constraint.

joinColumnName(relationName: string, referencedColumnName: string): string

Gets the name of the join column used in the one-to-one and many-to-one relations.

joinTableName(
firstTableName: string,
secondTableName: string,
firstPropertyName: string,
secondPropertyName: string,
): string

Gets the name of the join table used in the many-to-many relations.

joinTableColumnDuplicationPrefix(columnName: string, index: number): string

Columns in join tables can have duplicate names in case of self-referencing. This method provide a resolution for such column names.

joinTableColumnName(
tableName: string,
propertyName: string,
columnName?: string,
): string

Gets the name of the column used for columns in the junction tables.

The reverse?:boolean parameter denotes if the joinTableColumnName is called for the junctionColumn (false) or the inverseJunctionColumns (true)

joinTableInverseColumnName(
tableName: string,
propertyName: string,
columnName?: string,
): string

Gets the name of the column used for columns in the junction tables from the invers side of the relationship.

prefixTableName(prefix: string, tableName: string): string

Adds globally set prefix to the table name. This method is executed no matter if prefix was set or not. Table name is either user's given table name, either name generated from entity target. Note that table name comes here already normalized by #tableName method.

eagerJoinRelationAlias(alias: string, propertyPath: string): string

Gets the name of the alias used for relation joins.