ya-metrics-bot/migrations/20241201000918_schema.sql
erius 2069d9104c Added id field to all model's structs
Implemented YandexRequester summary method (TODO: test it)
Added BotData struct that will replace the Settings struct in the future
Implemented update methods for some structs' tables in BotData (TODO: implement update_requester and new methods)
Moved migrations to root directory
Note: use sqlx-cli from cargo to manage migrations from now on
Added *.db files to .gitignore
Added serde_json to Cargo.toml to parse json in YandexRequester
2024-12-01 04:46:54 +03:00

21 lines
488 B
SQL

CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY,
username TEXT NOT NULL,
permissions INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS proxies (
id INTEGER PRIMARY KEY,
ip BLOB NOT NULL,
port INTEGER NOT NULL,
user TEXT NOT NULL,
password TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS requesters (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
api TEXT NOT NULL,
proxy_id INTEGER,
FOREIGN KEY (proxy_id) REFERENCES proxies (id)
);