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