* Change a column definition * * @param {string} tableName Table name to change from * @param {string} attributeName Column name * @param {object} dataTypeOrOptions Attribute definition for new column * @param {object} [options] Query options
(tableName, attributeName, dataTypeOrOptions, options)
| 462 | * @param {object} [options] Query options |
| 463 | */ |
| 464 | async changeColumn(tableName, attributeName, dataTypeOrOptions, options) { |
| 465 | options = options || {}; |
| 466 | |
| 467 | const query = this.queryGenerator.attributesToSQL({ |
| 468 | [attributeName]: this.normalizeAttribute(dataTypeOrOptions) |
| 469 | }, { |
| 470 | context: class="st">'changeColumn', |
| 471 | table: tableName |
| 472 | }); |
| 473 | const sql = this.queryGenerator.changeColumnQuery(tableName, query); |
| 474 | |
| 475 | return this.sequelize.query(sql, options); |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Rejects if the table doesn't have the specified column, otherwise returns the column description. |