MCPcopy
hub / github.com/sequelize/sequelize / changeColumn

Method changeColumn

lib/dialects/abstract/query-interface.js:464–476  ·  lib/dialects/abstract/query-interface.js::QueryInterface.changeColumn

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 5

testFunction · 0.45
syncMethod · 0.45

Calls 4

normalizeAttributeMethod · 0.95
attributesToSQLMethod · 0.45
changeColumnQueryMethod · 0.45
queryMethod · 0.45

Tested by 1

testFunction · 0.36