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

resetPostgres() — drizzle-orm Function Reference

Architecture documentation for the resetPostgres() function in index.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  c3826895_dd12_87ae_9114_7e1180be92c9["resetPostgres()"]
  0fabdd81_61c9_bb7c_7ddf_dde7a6071abc["index.ts"]
  c3826895_dd12_87ae_9114_7e1180be92c9 -->|defined in| 0fabdd81_61c9_bb7c_7ddf_dde7a6071abc
  e2db8cff_d688_4f7a_2494_cbda1c3623cc["reset()"]
  e2db8cff_d688_4f7a_2494_cbda1c3623cc -->|calls| c3826895_dd12_87ae_9114_7e1180be92c9
  style c3826895_dd12_87ae_9114_7e1180be92c9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/index.ts lines 482–494

const resetPostgres = async (
	db: PgDatabase<any, any>,
	pgTables: { [key: string]: PgTable },
) => {
	const tablesToTruncate = Object.entries(pgTables).map(([_, table]) => {
		const config = getPgTableConfig(table);
		config.schema = config.schema === undefined ? 'public' : config.schema;

		return `"${config.schema}"."${config.name}"`;
	});

	await db.execute(sql.raw(`truncate ${tablesToTruncate.join(',')} cascade;`));
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does resetPostgres() do?
resetPostgres() is a function in the drizzle-orm codebase, defined in drizzle-seed/src/index.ts.
Where is resetPostgres() defined?
resetPostgres() is defined in drizzle-seed/src/index.ts at line 482.
What calls resetPostgres()?
resetPostgres() is called by 1 function(s): reset.

Analyze Your Own Codebase

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

Try Supermodel Free