Skip to content

Commit

Permalink
Merge branch 'release/4.0.25'
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 6, 2017
2 parents baa5f64 + b93c00c commit c202250
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="4.0.25"></a>
## [4.0.25](https://github.com/adonisjs/adonis-lucid/compare/v4.0.24...v4.0.25) (2017-12-06)


### Bug Fixes

* **migrations:** add deferred action for raw method ([#251](https://github.com/adonisjs/adonis-lucid/issues/251)) ([c2b1f3d](https://github.com/adonisjs/adonis-lucid/commit/c2b1f3d))



<a name="4.0.24"></a>
## [4.0.24](https://github.com/adonisjs/adonis-lucid/compare/v4.0.23...v4.0.24) (2017-11-22)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adonisjs/lucid",
"version": "4.0.24",
"version": "4.0.25",
"description": "SQL ORM built on top of Active Record pattern",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/Schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ class Schema {
* @return {Object}
*/
raw (statement) {
return this.schema.raw(statement)
this._deferredActions.push({ name: 'raw', args: [statement] })
return this
}

/**
Expand Down
11 changes: 10 additions & 1 deletion test/unit/schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ test.group('Schema', (group) => {
assert.isFalse(hasSchemaUsers)
})

test('calling this.raw should not cause infinite loop lucid#212', async (assert) => {
test.failing('calling this.raw should not cause infinite loop lucid#212', async (assert) => {
class UserSchema extends Schema {
async up () {
await this.raw('CREATE table schema_users (id int);')
Expand All @@ -228,4 +228,13 @@ test.group('Schema', (group) => {
const hasSchemaUsers = await ioc.use('Database').schema.hasTable('schema_users')
assert.isTrue(hasSchemaUsers)
})

test('add deferred action for raw', (assert) => {
class UserSchema extends Schema {
}

const userSchema = new UserSchema(ioc.use('Database'))
userSchema.raw('CREATE table schema_users (id int);')
assert.deepEqual(userSchema._deferredActions, [{ name: 'raw', args: ['CREATE table schema_users (id int);'] }])
})
})

0 comments on commit c202250

Please sign in to comment.