Skip to content

Commit

Permalink
Fixes #1303 (#2458)
Browse files Browse the repository at this point in the history
  • Loading branch information
elhigu committed Feb 8, 2018
1 parent 8771bd4 commit 44ccb33
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/schema/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import inherits from 'inherits';
import { EventEmitter } from 'events';
import { each, toArray } from 'lodash'
import { addQueryContext } from '../helpers';
import { addQueryContext, warn } from '../helpers';

// Constructor for the builder instance, typically called from
// `knex.builder`, accepting the current `knex` instance,
Expand Down Expand Up @@ -38,6 +38,15 @@ each([
'raw'
], function(method) {
SchemaBuilder.prototype[method] = function() {
if (method === 'createTableIfNotExists') {
warn([
'Use async .hasTable to check if table exists and then use plain .createTable. Since ',
'.createTableIfNotExists actually just generates plain "CREATE TABLE IF NOT EXIST..." ',
'query it will not work correctly if there are any alter table queries generated for ',
'columns afterwards. To not break old migrations this function is left untouched for now',
', but it should not be used when writing new code and it is removed from documentation.'
].join(''));
}
if (method === 'table') method = 'alterTable';
this._sequence.push({
method,
Expand Down

0 comments on commit 44ccb33

Please sign in to comment.