createTableIndexes() — drizzle-orm Function Reference
Architecture documentation for the createTableIndexes() function in introspect-sqlite.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 53155f85_7a2d_6004_4b1e_e7114e23ba01["createTableIndexes()"] c1c349dd_2e31_d056_728c_c034cebb41c0["introspect-sqlite.ts"] 53155f85_7a2d_6004_4b1e_e7114e23ba01 -->|defined in| c1c349dd_2e31_d056_728c_c034cebb41c0 5a8c82ee_a5ea_c82a_7f3f_71133b91a28a["schemaToTypeScript()"] 5a8c82ee_a5ea_c82a_7f3f_71133b91a28a -->|calls| 53155f85_7a2d_6004_4b1e_e7114e23ba01 d11905b4_a7b6_40f4_09ff_114b87f29eed["withCasing()"] 53155f85_7a2d_6004_4b1e_e7114e23ba01 -->|calls| d11905b4_a7b6_40f4_09ff_114b87f29eed 21c440e6_c6cd_8c72_25ae_ca6dbcd35945["indexName()"] 53155f85_7a2d_6004_4b1e_e7114e23ba01 -->|calls| 21c440e6_c6cd_8c72_25ae_ca6dbcd35945 style 53155f85_7a2d_6004_4b1e_e7114e23ba01 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/introspect-sqlite.ts lines 410–441
const createTableIndexes = (
tableName: string,
idxs: Index[],
casing: Casing,
): string => {
let statement = '';
idxs.forEach((it) => {
let idxKey = it.name.startsWith(tableName) && it.name !== tableName
? it.name.slice(tableName.length + 1)
: it.name;
idxKey = idxKey.endsWith('_index')
? idxKey.slice(0, -'_index'.length) + '_idx'
: idxKey;
idxKey = withCasing(idxKey, casing);
const indexGeneratedName = indexName(tableName, it.columns);
const escapedIndexName = indexGeneratedName === it.name ? '' : `"${it.name}"`;
statement += `\n\t`;
statement += it.isUnique ? 'uniqueIndex(' : 'index(';
statement += `${escapedIndexName})`;
statement += `.on(${
it.columns
.map((it) => `table.${withCasing(it, casing)}`)
.join(', ')
}),`;
});
return statement;
};
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does createTableIndexes() do?
createTableIndexes() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/introspect-sqlite.ts.
Where is createTableIndexes() defined?
createTableIndexes() is defined in drizzle-kit/src/introspect-sqlite.ts at line 410.
What does createTableIndexes() call?
createTableIndexes() calls 2 function(s): indexName, withCasing.
What calls createTableIndexes()?
createTableIndexes() is called by 1 function(s): schemaToTypeScript.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free