Table: user_tokens
Persistent login/session tokens.
Purpose
Describe why this table exists and what it stores.
Relationships
- List foreign keys and key joins (if any).
Columns
| Column | Definition |
|---|---|
id | int NOT NULL |
username | varchar(255) NOT NULL |
token_hash | char(64) NOT NULL |
expires | datetime NOT NULL |
ip_address | varchar(45) NOT NULL |
user_agent | varchar(255) NOT NULL |
created_at | timestamp NULL DEFAULT CURRENT_TIMESTAMP |
Indexes
List primary key and secondary indexes (if any).
Constraints
List foreign keys and other constraints (if any).
Operational notes / invariants
- Rules such as “no deletes”, “append-only”, “unique per church/FY”, etc.
DDL
CREATE TABLE `user_tokens` (
`id` int NOT NULL,
`username` varchar(255) NOT NULL,
`token_hash` char(64) NOT NULL,
`expires` datetime NOT NULL,
`ip_address` varchar(45) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;