(statement: MySqlModifyColumnStatement)
| 2513 | } |
| 2514 | |
| 2515 | convert(statement: MySqlModifyColumnStatement) { |
| 2516 | const { tableName, columnName } = statement; |
| 2517 | let columnType = ``; |
| 2518 | let columnDefault: any = ''; |
| 2519 | let columnNotNull = ''; |
| 2520 | let columnOnUpdate = ''; |
| 2521 | let columnAutoincrement = ''; |
| 2522 | let primaryKey = statement.columnPk ? ' PRIMARY KEY' : ''; |
| 2523 | let columnGenerated = ''; |
| 2524 | |
| 2525 | if (statement.type === 'alter_table_alter_column_drop_notnull') { |
| 2526 | columnType = ` ${statement.newDataType}`; |
| 2527 | columnDefault = statement.columnDefault |
| 2528 | ? ` DEFAULT ${statement.columnDefault}` |
| 2529 | : ''; |
| 2530 | columnNotNull = statement.columnNotNull ? ` NOT NULL` : ''; |
| 2531 | columnOnUpdate = statement.columnOnUpdate |
| 2532 | ? ` ON UPDATE CURRENT_TIMESTAMP` |
| 2533 | : ''; |
| 2534 | columnAutoincrement = statement.columnAutoIncrement |
| 2535 | ? ' AUTO_INCREMENT' |
| 2536 | : ''; |
| 2537 | } else if (statement.type === 'alter_table_alter_column_set_notnull') { |
| 2538 | columnNotNull = ` NOT NULL`; |
| 2539 | columnType = ` ${statement.newDataType}`; |
| 2540 | columnDefault = statement.columnDefault |
| 2541 | ? ` DEFAULT ${statement.columnDefault}` |
| 2542 | : ''; |
| 2543 | columnOnUpdate = statement.columnOnUpdate |
| 2544 | ? ` ON UPDATE CURRENT_TIMESTAMP` |
| 2545 | : ''; |
| 2546 | columnAutoincrement = statement.columnAutoIncrement |
| 2547 | ? ' AUTO_INCREMENT' |
| 2548 | : ''; |
| 2549 | } else if (statement.type === 'alter_table_alter_column_drop_on_update') { |
| 2550 | columnNotNull = statement.columnNotNull ? ` NOT NULL` : ''; |
| 2551 | columnType = ` ${statement.newDataType}`; |
| 2552 | columnDefault = statement.columnDefault |
| 2553 | ? ` DEFAULT ${statement.columnDefault}` |
| 2554 | : ''; |
| 2555 | columnOnUpdate = ''; |
| 2556 | columnAutoincrement = statement.columnAutoIncrement |
| 2557 | ? ' AUTO_INCREMENT' |
| 2558 | : ''; |
| 2559 | } else if (statement.type === 'alter_table_alter_column_set_on_update') { |
| 2560 | columnNotNull = statement.columnNotNull ? ` NOT NULL` : ''; |
| 2561 | columnOnUpdate = ` ON UPDATE CURRENT_TIMESTAMP`; |
| 2562 | columnType = ` ${statement.newDataType}`; |
| 2563 | columnDefault = statement.columnDefault |
| 2564 | ? ` DEFAULT ${statement.columnDefault}` |
| 2565 | : ''; |
| 2566 | columnAutoincrement = statement.columnAutoIncrement |
| 2567 | ? ' AUTO_INCREMENT' |
| 2568 | : ''; |
| 2569 | } else if ( |
| 2570 | statement.type === 'alter_table_alter_column_set_autoincrement' |
| 2571 | ) { |
| 2572 | columnNotNull = statement.columnNotNull ? ` NOT NULL` : ''; |
no outgoing calls
no test coverage detected