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

Method addColumn

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

* 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

421 * @returns {Promise}
422 */
423 async addColumn(table, key, attribute, options) {
424 if (!table || !key || !attribute) {
425 throw new Error('addColumn takes at least 3 arguments (table, attribute name, attribute definition)');
426 }
427
428 options = options || {};
429 attribute = this.sequelize.normalizeAttribute(attribute);
430 return await this.sequelize.query(this.queryGenerator.addColumnQuery(table, key, attribute), options);
431 }
432
433 /**
434 * Remove a column from a table

Callers 6

testArgsFunction · 0.80
testFunction · 0.80
syncMethod · 0.80

Calls 3

normalizeAttributeMethod · 0.45
queryMethod · 0.45
addColumnQueryMethod · 0.45

Tested by 2

testArgsFunction · 0.64
testFunction · 0.64