Home / Function/ dbConfigSchema() — astro Function Reference

dbConfigSchema() — astro Function Reference

Architecture documentation for the dbConfigSchema() function in schemas.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  cf1bf1ef_7395_bc10_b3fd_e06d25efb0bd["dbConfigSchema()"]
  05094702_dfea_fe15_694a_0f5d1d294954["schemas.ts"]
  cf1bf1ef_7395_bc10_b3fd_e06d25efb0bd -->|defined in| 05094702_dfea_fe15_694a_0f5d1d294954
  style cf1bf1ef_7395_bc10_b3fd_e06d25efb0bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/db/src/core/schemas.ts lines 224–250

	.transform(({ tables = {}, ...config }) => {
		return {
			...config,
			tables: mapObject(tables, (tableName, table) => {
				const { indexes = {} } = table;
				if (!Array.isArray(indexes)) {
					return { ...table, indexes };
				}
				const resolvedIndexes: Record<string, z.infer<typeof resolvedIndexSchema>> = {};
				for (const index of indexes) {
					if (index.name) {
						const { name, ...rest } = index;
						resolvedIndexes[index.name] = rest;
						continue;
					}
					// Sort index columns to ensure consistent index names
					const indexOn = Array.isArray(index.on) ? index.on.sort().join('_') : index.on;
					const name = tableName + '_' + indexOn + '_idx';
					resolvedIndexes[name] = index;
				}
				return {
					...table,
					indexes: resolvedIndexes,
				};
			}),
		};
	});

Domain

Subdomains

Frequently Asked Questions

What does dbConfigSchema() do?
dbConfigSchema() is a function in the astro codebase, defined in packages/db/src/core/schemas.ts.
Where is dbConfigSchema() defined?
dbConfigSchema() is defined in packages/db/src/core/schemas.ts at line 224.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free