Add token model
This commit is contained in:
parent
3b91237dd6
commit
521dd08c70
|
@ -1,4 +1,4 @@
|
||||||
import add_column, create_table, types from require "lapis.db.schema"
|
import add_column, create_table, drop_column, types from require "lapis.db.schema"
|
||||||
|
|
||||||
{
|
{
|
||||||
[1]: =>
|
[1]: =>
|
||||||
|
@ -26,4 +26,14 @@ import add_column, create_table, types from require "lapis.db.schema"
|
||||||
|
|
||||||
[6]: =>
|
[6]: =>
|
||||||
add_column "users", "registrar_password", types.text
|
add_column "users", "registrar_password", types.text
|
||||||
|
|
||||||
|
[7]: =>
|
||||||
|
create_table "tokens", {
|
||||||
|
{ "id", types.serial }
|
||||||
|
{ "user_id", types.integer }
|
||||||
|
{ "token", types.text }
|
||||||
|
}
|
||||||
|
|
||||||
|
[8]: =>
|
||||||
|
drop_column "users", "registrar_password"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
db = require "lapis.db"
|
||||||
|
import Model from require "lapis.db.model"
|
||||||
|
|
||||||
|
require "models.user"
|
||||||
|
|
||||||
|
export class Tokens extends Model
|
||||||
|
get_user: =>
|
||||||
|
return Users\find extension @user_id
|
Loading…
Reference in New Issue