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

Method changeColumn

src/dialects/abstract/query-interface.js:486–498  ·  view source on GitHub ↗

* 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

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.

Callers 6

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