mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-10 10:53:24 +00:00
- Remove origin column from offers table - Remove getOrigin() function and X-Rondevu-Global header support - Simplify all storage methods to use only offer code - Add migration 0003_remove_origin.sql - Update error messages to remove "origin mismatch" wording This simplifies the system by removing origin-based isolation. All offers are now identified solely by their unique code/ID. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
954 B
SQL
30 lines
954 B
SQL
-- Migration: Remove origin column from offers table
|
|
-- This simplifies offer lookup to only use offer codes
|
|
-- Origin-based bucketing is no longer needed
|
|
|
|
-- Create new offers table without origin column
|
|
CREATE TABLE offers_new (
|
|
code TEXT PRIMARY KEY,
|
|
peer_id TEXT NOT NULL CHECK(length(peer_id) <= 1024),
|
|
offer TEXT NOT NULL,
|
|
answer TEXT,
|
|
offer_candidates TEXT NOT NULL DEFAULT '[]',
|
|
answer_candidates TEXT NOT NULL DEFAULT '[]',
|
|
created_at INTEGER NOT NULL,
|
|
expires_at INTEGER NOT NULL
|
|
);
|
|
|
|
-- Copy data from old table
|
|
INSERT INTO offers_new (code, peer_id, offer, answer, offer_candidates, answer_candidates, created_at, expires_at)
|
|
SELECT code, peer_id, offer, answer, offer_candidates, answer_candidates, created_at, expires_at
|
|
FROM offers;
|
|
|
|
-- Drop old table
|
|
DROP TABLE offers;
|
|
|
|
-- Rename new table
|
|
ALTER TABLE offers_new RENAME TO offers;
|
|
|
|
-- Recreate index
|
|
CREATE INDEX IF NOT EXISTS idx_offers_expires_at ON offers(expires_at);
|