From a67cf297df78521d1c2dee0dc2746a8046675b56 Mon Sep 17 00:00:00 2001
From: wikiapiserver
Date: Thu, 25 Jun 2026 21:37:16 +0200
Subject: chore: add SQL migration files for production schema

- sql/000_widen_tokens.sql: widen token columns to TEXT, add
  refresh_token_created and access_token_created timestamps
- sql/001_add_api_logs.sql: create api_logs table for request logging
---
 sql/000_widen_tokens.sql | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 sql/000_widen_tokens.sql

(limited to 'sql/000_widen_tokens.sql')

diff --git a/sql/000_widen_tokens.sql b/sql/000_widen_tokens.sql
new file mode 100644
index 0000000..ed358b2
--- /dev/null
+++ b/sql/000_widen_tokens.sql
@@ -0,0 +1,10 @@
+-- Widen token columns and add separate timestamps.
+-- Run this before 001_add_api_logs.sql.
+
+-- Widen token columns (JWTs can exceed 255 chars).
+ALTER TABLE account MODIFY refresh_token TEXT DEFAULT NULL;
+ALTER TABLE account MODIFY access_token  TEXT DEFAULT NULL;
+
+-- Add separate created timestamps if they do not exist.
+ALTER TABLE account ADD COLUMN IF NOT EXISTS refresh_token_created TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
+ALTER TABLE account ADD COLUMN IF NOT EXISTS access_token_created  TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
-- 
cgit v1.2.3

