MCPcopy
hub / github.com/sequelize/sequelize / addColumnQuery

Method addColumnQuery

src/dialects/db2/query-generator.js:197–212  ·  view source on GitHub ↗
(table, key, dataType)

Source from the content-addressed store, hash-verified

195 }
196
197 addColumnQuery(table, key, dataType) {
198 dataType.field = key;
199
200 const query = 'ALTER TABLE <%= table %> ADD <%= attribute %>;',
201 attribute = _.template('<%= key %> <%= definition %>', this._templateSettings)({
202 key: this.quoteIdentifier(key),
203 definition: this.attributeToSQL(dataType, {
204 context: 'addColumn'
205 })
206 });
207
208 return _.template(query, this._templateSettings)({
209 table: this.quoteTable(table),
210 attribute
211 });
212 }
213
214 removeColumnQuery(tableName, attributeName) {
215 const query = 'ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;';

Callers 3

add-column.test.jsFile · 0.45
addColumnMethod · 0.45

Calls 3

quoteIdentifierMethod · 0.95
attributeToSQLMethod · 0.95
quoteTableMethod · 0.80

Tested by

no test coverage detected