Home / Class/ PgAlterTableAlterColumnDropPrimaryKeyConvertor Class — drizzle-orm Architecture

PgAlterTableAlterColumnDropPrimaryKeyConvertor Class — drizzle-orm Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6ff9bf46_4b03_69e2_224b_52132ad6ad5c["PgAlterTableAlterColumnDropPrimaryKeyConvertor"]
  fe4174c7_3b9c_5b26_98a0_b2395ca21939["sqlgenerator.ts"]
  6ff9bf46_4b03_69e2_224b_52132ad6ad5c -->|defined in| fe4174c7_3b9c_5b26_98a0_b2395ca21939
  a924ef3e_5153_2297_e8de_3613afe08b86["can()"]
  6ff9bf46_4b03_69e2_224b_52132ad6ad5c -->|method| a924ef3e_5153_2297_e8de_3613afe08b86
  1e609fbc_22ce_fea5_d274_9c3cb5156b3e["convert()"]
  6ff9bf46_4b03_69e2_224b_52132ad6ad5c -->|method| 1e609fbc_22ce_fea5_d274_9c3cb5156b3e

Relationship Graph

Source Code

drizzle-kit/src/sqlgenerator.ts lines 3265–3292

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

	convert(statement: JsonAlterColumnDropPrimaryKeyStatement) {
		const { tableName, columnName, schema } = statement;
		return `/* 
    Unfortunately in current drizzle-kit version we can't automatically get name for primary key.
    We are working on making it available!

    Meanwhile you can:
        1. Check pk name in your database, by running
            SELECT constraint_name FROM information_schema.table_constraints
            WHERE table_schema = '${typeof schema === 'undefined' || schema === '' ? 'public' : schema}'
                AND table_name = '${tableName}'
                AND constraint_type = 'PRIMARY KEY';
        2. Uncomment code below and paste pk name manually
        
    Hope to release this update as soon as possible
*/

-- ALTER TABLE "${tableName}" DROP CONSTRAINT "<constraint_name>";`;
	}
}

Domain

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free