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

convert() — drizzle-orm Function Reference

Architecture documentation for the convert() function in sqlgenerator.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  91fafd8c_7377_ee91_fe23_c844fa1f63fb["convert()"]
  3fad0c3d_f947_1855_2ce8_2683d33326e4["SqliteAlterTableDeleteCompositePrimaryKeyConvertor"]
  91fafd8c_7377_ee91_fe23_c844fa1f63fb -->|defined in| 3fad0c3d_f947_1855_2ce8_2683d33326e4
  style 91fafd8c_7377_ee91_fe23_c844fa1f63fb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/sqlgenerator.ts lines 3195–3215

	convert(statement: JsonDeleteCompositePK) {
		let msg = '/*\n';
		msg += `You're trying to delete PRIMARY KEY(${statement.data}) from '${statement.tableName}' table\n`;
		msg += 'SQLite does not supportprimary key deletion from existing table\n';
		msg += 'You can do it in 3 steps with drizzle orm:\n';
		msg += ' - create new mirror table table without pk, rename current table to old_table, generate SQL\n';
		msg += ' - migrate old data from one table to another\n';
		msg += ' - delete old_table in schema, generate sql\n\n';
		msg += 'or create manual migration like below:\n\n';
		msg += 'ALTER TABLE table_name RENAME TO old_table;\n';
		msg += 'CREATE TABLE table_name (\n';
		msg += '\tcolumn1 datatype [ NULL | NOT NULL ],\n';
		msg += '\tcolumn2 datatype [ NULL | NOT NULL ],\n';
		msg += '\t...\n';
		msg += '\tPRIMARY KEY (pk_col1, pk_col2, ... pk_col_n)\n';
		msg += ' );\n';
		msg += 'INSERT INTO table_name SELECT * FROM old_table;\n\n';
		msg += "Due to that we don't generate migration automatically and it has to be done manually\n";
		msg += '*/\n';
		return msg;
	}

Domain

Subdomains

Frequently Asked Questions

What does convert() do?
convert() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is convert() defined?
convert() is defined in drizzle-kit/src/sqlgenerator.ts at line 3195.

Analyze Your Own Codebase

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

Try Supermodel Free