Seeing some strange things happening.
When I use the code:
* index (request, response) {
let users = yield User.all();
response.json(users);
}
I get an error:
{ [Error: select * from "users" where "users"."deleted_at" is null - SQLITE_ERROR: no such column: users.deleted_at] errno: 1, code: 'SQLITE_ERROR' }
when trying to access my server:
http://localhost:3333/users
However, when I go:
* index (request, response) {
const users = yield Database.table('users').select('*');
response.json(users);
}
I get the expected JSON response back without any errors.
I've just discovered Adonis a few hours ago, and taking it for a quick spin.
Also, can we please get some documentation on defining Models in Adonis, I mean setting the properties like username, password, email, and what datatype they're suppose to be etc.
The documentation so far only show how to generate a model using ace command, and how to override special functions such as visible()
and hidden()
.
How do we define our model properties ?
Is it:
class User extends Lucid {
username: { type: 'string', length: 6 },
email: { type: 'email' },
age: { type: 'integer' }
}
Nice framework so far.