mirror of
https://github.com/Syfaro/fuzzysearch.git
synced 2024-11-10 17:02:38 +00:00
27 lines
669 B
MySQL
27 lines
669 B
MySQL
|
CREATE TABLE account (
|
||
|
id SERIAL PRIMARY KEY,
|
||
|
email TEXT UNIQUE NOT NULL,
|
||
|
password TEXT NOT NULL,
|
||
|
email_verifier TEXT
|
||
|
);
|
||
|
|
||
|
CREATE TABLE api_key (
|
||
|
id SERIAL PRIMARY KEY,
|
||
|
user_id INTEGER NOT NULL REFERENCES account (id),
|
||
|
name TEXT,
|
||
|
key TEXT UNIQUE NOT NULL,
|
||
|
name_limit SMALLINT NOT NULL,
|
||
|
image_limit SMALLINT NOT NULL,
|
||
|
hash_limit SMALLINT NOT NULL
|
||
|
);
|
||
|
|
||
|
CREATE TABLE rate_limit (
|
||
|
api_key_id INTEGER NOT NULL REFERENCES api_key (id),
|
||
|
time_window BIGINT NOT NULL,
|
||
|
group_name TEXT NOT NULL,
|
||
|
count SMALLINT NOT NULL DEFAULT 0,
|
||
|
|
||
|
CONSTRAINT unique_window
|
||
|
PRIMARY KEY (api_key_id, time_window, group_name)
|
||
|
);
|