Home / Class/ PgDeleteForeignKeyConvertor Class — drizzle-orm Architecture

PgDeleteForeignKeyConvertor Class — drizzle-orm Architecture

Architecture documentation for the PgDeleteForeignKeyConvertor class in sqlgenerator.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  a5849b12_4b6f_dbc1_2124_3d727813de9f["PgDeleteForeignKeyConvertor"]
  fe4174c7_3b9c_5b26_98a0_b2395ca21939["sqlgenerator.ts"]
  a5849b12_4b6f_dbc1_2124_3d727813de9f -->|defined in| fe4174c7_3b9c_5b26_98a0_b2395ca21939
  db68bae1_7158_5ad7_4bc0_beed180f3b81["can()"]
  a5849b12_4b6f_dbc1_2124_3d727813de9f -->|method| db68bae1_7158_5ad7_4bc0_beed180f3b81
  2b1abec1_dfed_c76e_53e0_cfb047ce9320["convert()"]
  a5849b12_4b6f_dbc1_2124_3d727813de9f -->|method| 2b1abec1_dfed_c76e_53e0_cfb047ce9320

Relationship Graph

Source Code

drizzle-kit/src/sqlgenerator.ts lines 3469–3484

class PgDeleteForeignKeyConvertor extends Convertor {
	can(statement: JsonStatement, dialect: Dialect): boolean {
		return statement.type === 'delete_reference' && dialect === 'postgresql';
	}

	convert(statement: JsonDeleteReferenceStatement): string {
		const tableFrom = statement.tableName; // delete fk from renamed table case
		const { name } = PgSquasher.unsquashFK(statement.data);

		const tableNameWithSchema = statement.schema
			? `"${statement.schema}"."${tableFrom}"`
			: `"${tableFrom}"`;

		return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${name}";\n`;
	}
}

Domain

Frequently Asked Questions

What is the PgDeleteForeignKeyConvertor class?
PgDeleteForeignKeyConvertor is a class in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is PgDeleteForeignKeyConvertor defined?
PgDeleteForeignKeyConvertor is defined in drizzle-kit/src/sqlgenerator.ts at line 3469.

Analyze Your Own Codebase

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

Try Supermodel Free