add api endpoint to preview babycode
This commit is contained in:
@ -91,4 +91,15 @@ return {
|
||||
|
||||
db.query("COMMIT")
|
||||
end,
|
||||
|
||||
[12] = function ()
|
||||
schema.create_table("api_rate_limits", {
|
||||
{"id", types.integer{primary_key = true}},
|
||||
{"method", types.text{null = false}},
|
||||
{"user_id", "INTEGER REFERENCES users(id) ON DELETE CASCADE"},
|
||||
{"logged_at", "INTEGER DEFAULT (unixepoch(CURRENT_TIMESTAMP))"},
|
||||
})
|
||||
|
||||
db.query("CREATE INDEX idx_rate_limit_user_method ON api_rate_limits (user_id, method)")
|
||||
end,
|
||||
}
|
||||
|
Reference in New Issue
Block a user