Home / Function/ preparePullConfig() — drizzle-orm Function Reference

preparePullConfig() — drizzle-orm Function Reference

Architecture documentation for the preparePullConfig() function in utils.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7["preparePullConfig()"]
  09e5bcf1_0f03_3dbd_fbdb_762440f28855["utils.ts"]
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 -->|defined in| 09e5bcf1_0f03_3dbd_fbdb_762440f28855
  2d811fdf_1e13_3829_a25f_89056cb2a502["pull.transform()"]
  2d811fdf_1e13_3829_a25f_89056cb2a502 -->|calls| f2b425f7_cbc7_24b4_bcbe_192d9e3373b7
  827ca13a_d3f2_c106_4b6e_0f0b56e44548["flattenPull()"]
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 -->|calls| 827ca13a_d3f2_c106_4b6e_0f0b56e44548
  face3c40_88e9_a534_6538_9c662631c6f6["drizzleConfigFromFile()"]
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 -->|calls| face3c40_88e9_a534_6538_9c662631c6f6
  b0ef3d06_896b_eefc_c410_dfb419673d70["error()"]
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 -->|calls| b0ef3d06_896b_eefc_c410_dfb419673d70
  b00190f0_9c7c_acbf_86f7_950ac8c79592["wrapParam()"]
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 -->|calls| b00190f0_9c7c_acbf_86f7_950ac8c79592
  071bfc71_ad06_c0c4_cba2_360298dd4b47["assertUnreachable()"]
  f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 -->|calls| 071bfc71_ad06_c0c4_cba2_360298dd4b47
  style f2b425f7_cbc7_24b4_bcbe_192d9e3373b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/cli/commands/utils.ts lines 451–648

export const preparePullConfig = async (
	options: Record<string, unknown>,
	from: 'cli' | 'config',
): Promise<
	(
		| {
			dialect: 'mysql';
			credentials: MysqlCredentials;
		}
		| {
			dialect: 'postgresql';
			credentials: PostgresCredentials;
		}
		| {
			dialect: 'sqlite';
			credentials: SqliteCredentials;
		}
		| {
			dialect: 'turso';
			credentials: LibSQLCredentials;
		}
		| {
			dialect: 'singlestore';
			credentials: SingleStoreCredentials;
		}
		| {
			dialect: 'gel';
			credentials?: GelCredentials;
		}
	) & {
		out: string;
		breakpoints: boolean;
		casing: Casing;
		tablesFilter: string[];
		schemasFilter: string[];
		prefix: Prefix;
		entities: Entities;
	}
> => {
	const raw = flattenPull(
		from === 'config'
			? await drizzleConfigFromFile(options.config as string | undefined)
			: options,
	);
	const parsed = pullParams.safeParse(raw);

	if (parsed.error) {
		console.log(error('Please provide required params:'));
		console.log(wrapParam('dialect', raw.dialect));
		process.exit(1);
	}

	const config = parsed.data;
	const dialect = config.dialect;

	const tablesFilterConfig = config.tablesFilter;
	const tablesFilter = tablesFilterConfig
		? typeof tablesFilterConfig === 'string'
			? [tablesFilterConfig]
			: tablesFilterConfig
		: [];

	if (config.extensionsFilters) {
		if (
			config.extensionsFilters.includes('postgis')
			&& dialect === 'postgresql'
		) {
			tablesFilter.push(
				...['!geography_columns', '!geometry_columns', '!spatial_ref_sys'],
			);
		}
	}

	const schemasFilterConfig = config.schemaFilter; // TODO: consistent naming
	const schemasFilter = schemasFilterConfig
		? typeof schemasFilterConfig === 'string'
			? [schemasFilterConfig]
			: schemasFilterConfig
		: [];

	if (dialect === 'postgresql') {

Domain

Subdomains

Called By

Frequently Asked Questions

What does preparePullConfig() do?
preparePullConfig() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/utils.ts.
Where is preparePullConfig() defined?
preparePullConfig() is defined in drizzle-kit/src/cli/commands/utils.ts at line 451.
What does preparePullConfig() call?
preparePullConfig() calls 5 function(s): assertUnreachable, drizzleConfigFromFile, error, flattenPull, wrapParam.
What calls preparePullConfig()?
preparePullConfig() is called by 1 function(s): pull.transform.

Analyze Your Own Codebase

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

Try Supermodel Free