MCPcopy
hub / github.com/sequelize/sequelize / addColumn

Method addColumn

lib/dialects/abstract/query-interface.js:401–409  ·  lib/dialects/abstract/query-interface.js::QueryInterface.addColumn

* Add a new column to a table * * ```js * queryInterface.addColumn('tableA', 'columnC', Sequelize.STRING, { * after: 'columnB' // after option is only supported by MySQL * }); * ``` * * @param {string} table Table to add column to * @param {string} key Column

(table, key, attribute, options)

Source from the content-addressed store, hash-verified

399 * @returns {Promise}
400 */
401 async addColumn(table, key, attribute, options) {
402 if (!table || !key || !attribute) {
403 throw new Error(class="st">'addColumn takes at least 3 arguments (table, attribute name, attribute definition)');
404 }
405
406 options = options || {};
407 attribute = this.sequelize.normalizeAttribute(attribute);
408 return await this.sequelize.query(this.queryGenerator.addColumnQuery(table, key, attribute), options);
409 }
410
411 /**
412 * Remove a column from a table

Callers 6

testFunction · 0.80
syncMethod · 0.80
testArgsFunction · 0.80

Calls 3

normalizeAttributeMethod · 0.45
queryMethod · 0.45
addColumnQueryMethod · 0.45

Tested by 2

testFunction · 0.64
testArgsFunction · 0.64