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 05245ff2_77d6_8967_71a2_b015cc5a8c66["convert()"] fd7f48c8_e27a_7047_e96e_2180fd469b79["SqliteAlterTableCreateCompositePrimaryKeyConvertor"] 05245ff2_77d6_8967_71a2_b015cc5a8c66 -->|defined in| fd7f48c8_e27a_7047_e96e_2180fd469b79 style 05245ff2_77d6_8967_71a2_b015cc5a8c66 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/sqlgenerator.ts lines 3168–3188
convert(statement: JsonCreateCompositePK) {
let msg = '/*\n';
msg += `You're trying to add PRIMARY KEY(${statement.data}) to '${statement.tableName}' table\n`;
msg += 'SQLite does not support adding primary key to an already created table\n';
msg += 'You can do it in 3 steps with drizzle orm:\n';
msg += ' - create new mirror table with needed 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
Defined In
Source
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 3168.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free