diff --git a/src/Schema/index.js b/src/Schema/index.js index 6527002c..0cc89292 100644 --- a/src/Schema/index.js +++ b/src/Schema/index.js @@ -286,6 +286,15 @@ class Schema { return this.createTable(...args) } + /** + * Alias for @ref('Schema.createTableIfNotExists') + * + * @method createIfNotExists + */ + createIfNotExists (...args) { + return this.createTableIfNotExists(...args) + } + /** * Alias for @ref('Schema.dropTable') * diff --git a/test/unit/schema.spec.js b/test/unit/schema.spec.js index a117f249..1b192524 100644 --- a/test/unit/schema.spec.js +++ b/test/unit/schema.spec.js @@ -66,7 +66,7 @@ test.group('Schema', (group) => { } const userSchema = new UserSchema(ioc.use('Database')) const fn = function () {} - userSchema.createTableIfNotExists('users', fn) + userSchema.createIfNotExists('users', fn) assert.deepEqual(userSchema._deferredActions, [{ name: 'createTableIfNotExists', args: ['users', fn] }]) })