{"action":"created","issue":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/26","repository_url":"https://api.github.com/repos/adonisjs/adonis-lucid","labels_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/26/comments","events_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/26/events","html_url":"https://github.com/adonisjs/adonis-lucid/issues/26","id":146697374,"number":26,"title":"Lucid within Ace command","user":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-07T17:48:24Z","updated_at":"2016-04-08T04:09:15Z","closed_at":null,"body":"@Matthijn commented on [Thu Apr 07 2016](https://github.com/adonisjs/adonis-framework/issues/135)\n\nCurrently I'm writing a very simple command to run some seeds. And writing the command itself goes wel (e.g it searches the seed directory for seed files, and calls a run method on those).\r\n\r\nHowever, as soon as I add a use('App/Model/User') (or any Lucid model) it will hang on that point. It's like it is trying to connect to the database, but it never actually does that (and might be waiting for a timeout of some sort). There is no error, it just hangs. \r\n\r\nThe database (and same model) is approachable within the same Adonis application from a GET request to a route. So, I'm wondering, is the database connection not loaded? \r\n\r\nI took a peek at how it was done in de migration command. But honestly, that did not make me much wiser. \n\n---\n\n@thetutlage commented on [Thu Apr 07 2016](https://github.com/adonisjs/adonis-framework/issues/135#issuecomment-206705372)\n\nAre you able to seed your database? Means are you able to save records in your database ?\r\n\n\n"},"comment":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/comments/207201125","html_url":"https://github.com/adonisjs/adonis-lucid/issues/26#issuecomment-207201125","issue_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/26","id":207201125,"user":{"login":"Matthijn","id":1755544,"avatar_url":"https://avatars.githubusercontent.com/u/1755544?v=3","gravatar_id":"","url":"https://api.github.com/users/Matthijn","html_url":"https://github.com/Matthijn","followers_url":"https://api.github.com/users/Matthijn/followers","following_url":"https://api.github.com/users/Matthijn/following{/other_user}","gists_url":"https://api.github.com/users/Matthijn/gists{/gist_id}","starred_url":"https://api.github.com/users/Matthijn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Matthijn/subscriptions","organizations_url":"https://api.github.com/users/Matthijn/orgs","repos_url":"https://api.github.com/users/Matthijn/repos","events_url":"https://api.github.com/users/Matthijn/events{/privacy}","received_events_url":"https://api.github.com/users/Matthijn/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T04:09:15Z","updated_at":"2016-04-08T04:09:15Z","body":"Well, it doesn't even get that far. \r\n\r\nI've distilled the code to this:\r\n\r\nSeed.js\r\n```\r\n'use strict'\r\n\r\nconst User = use('App/Model/User')\r\n\r\nclass Seed\r\n{\r\n\r\n  static get description()\r\n  {\r\n    return 'Command to run seeds, pass it the filename of the seed (without extension) or nothing to run all seeds'\r\n  }\r\n\r\n  static get signature()\r\n  {\r\n    return '{name?: The name of the Seed to run, leave empty for all}'\r\n  }\r\n\r\n  * handle(options, flags)\r\n  {\r\n    console.log('Hello World')\r\n  }\r\n\r\n}\r\n\r\nmodule.exports = Seed\r\n\r\n```\r\n\r\nUser.js\r\n\r\n```\r\n'use strict'\r\n\r\nconst Lucid = use('Lucid')\r\n\r\nclass User extends Lucid\r\n{\r\n\r\n}\r\n\r\nmodule.exports = User\r\n```\r\n\r\nI am running an Postgresql database. It does connect properly (because I have made migrations with the existing migration command and they run just fine). \r\n\r\nNow, if I run the command: `./ace seed:run` it will display: `Hello World` but run indefinitely. However if I comment out the line: `const User = use('App/Model/User')` in Seed.js it wil display the same, but then just end properly. \r\n\r\nSpecs:\r\n\r\nNode: v5.9.1\r\nNpm: 3.7.3\r\n\r\nPackage.json:\r\n\r\n```\r\n    \"adonis-ace\": \"^2.0.7\",\r\n    \"adonis-commands\": \"^2.0.3\",\r\n    \"adonis-fold\": \"^2.0.1\",\r\n    \"adonis-framework\": \"^2.0.9\",\r\n    \"adonis-lucid\": \"^2.0.5\",\r\n    \"adonis-middleware\": \"^1.0.5\",\r\n```\r\n"}}