* 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)
| 484 | * @param {object} [options] Query options |
| 485 | */ |
| 486 | async changeColumn(tableName, attributeName, dataTypeOrOptions, options) { |
| 487 | options = options || {}; |
| 488 | |
| 489 | const query = this.queryGenerator.attributesToSQL({ |
| 490 | [attributeName]: this.normalizeAttribute(dataTypeOrOptions) |
| 491 | }, { |
| 492 | context: 'changeColumn', |
| 493 | table: tableName |
| 494 | }); |
| 495 | const sql = this.queryGenerator.changeColumnQuery(tableName, query); |
| 496 | |
| 497 | return this.sequelize.query(sql, options); |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * Rejects if the table doesn't have the specified column, otherwise returns the column description. |