From 8ff3776e75d435eb82222fc3b03810bc785e6ee3 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 7 Aug 2017 23:19:51 +0200 Subject: [PATCH] Completely rewrite SQLite schema for table 'users_throttling' --- Database/SQLite.sql | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Database/SQLite.sql b/Database/SQLite.sql index 657845a..f76ad33 100644 --- a/Database/SQLite.sql +++ b/Database/SQLite.sql @@ -51,10 +51,9 @@ CREATE TABLE "users_resets" ( CREATE INDEX "users_resets.user_expires" ON "users_resets" ("user", "expires"); CREATE TABLE "users_throttling" ( - "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK ("id" >= 0), - "action_type" TEXT NOT NULL CHECK ("action_type" IN ("login", "register", "confirm_email")), - "selector" VARCHAR(44) DEFAULT NULL, - "time_bucket" INTEGER NOT NULL CHECK ("time_bucket" >= 0), - "attempts" INTEGER NOT NULL CHECK ("attempts" >= 0) DEFAULT "1", - CONSTRAINT "action_type_selector_time_bucket" UNIQUE ("action_type", "selector", "time_bucket") + "bucket" VARCHAR(44) PRIMARY KEY NOT NULL, + "tokens" REAL NOT NULL CHECK ("tokens" >= 0), + "replenished_at" INTEGER NOT NULL CHECK ("replenished_at" >= 0), + "expires_at" INTEGER NOT NULL CHECK ("expires_at" >= 0) ); +CREATE INDEX "users_throttling.expires_at" ON "users_throttling" ("expires_at");