Add token model

This commit is contained in:
Sam Dodrill 2015-01-07 14:35:14 -08:00
parent 3b91237dd6
commit 521dd08c70
2 changed files with 19 additions and 1 deletions

View File

@ -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]: =>
@ -26,4 +26,14 @@ import add_column, create_table, types from require "lapis.db.schema"
[6]: =>
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"
}

8
models/token.moon Normal file
View File

@ -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