30 lines
835 B
Plaintext
30 lines
835 B
Plaintext
|
import create_table, types, create_index from require "lapis.db.schema"
|
||
|
import make_migrations, autoload from require "locator"
|
||
|
import settings from autoload "utility"
|
||
|
|
||
|
make_migrations {
|
||
|
[1524503851]: =>
|
||
|
create_table "tasks", {
|
||
|
{"id", types.serial primary_key: true}
|
||
|
{"user_id", types.foreign_key}
|
||
|
{"content", types.text}
|
||
|
{"done", types.boolean default: false}
|
||
|
|
||
|
{"created_at", types.time}
|
||
|
{"updated_at", types.time}
|
||
|
}
|
||
|
create_table "api_keys", {
|
||
|
{"user_id", types.foreign_key}
|
||
|
{"key", types.varchar unique: true}
|
||
|
|
||
|
{"created_at", types.time}
|
||
|
{"updated_at", types.time}
|
||
|
}
|
||
|
|
||
|
create_index "api_keys", "user_id"
|
||
|
create_index "api_keys", "key"
|
||
|
create_index "tasks", "id"
|
||
|
create_index "tasks", "user_id"
|
||
|
create_index "tasks", "user_id", "done"
|
||
|
}
|