mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-12 11:53:24 +00:00
Fix fresh schema to match D1 storage expectations
Changed offers table to use service_id (nullable) instead of service_fqn. This matches the actual D1 storage implementation in d1.ts which expects: - service_id TEXT (optional link to service) - NOT service_fqn (that's only in the services table) Resolves 'NOT NULL constraint failed: offers.service_fqn' error.
This commit is contained in:
@@ -11,10 +11,11 @@ DROP TABLE IF EXISTS usernames;
|
|||||||
CREATE TABLE offers (
|
CREATE TABLE offers (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
peer_id TEXT NOT NULL,
|
peer_id TEXT NOT NULL,
|
||||||
service_fqn TEXT NOT NULL,
|
service_id TEXT,
|
||||||
sdp TEXT NOT NULL,
|
sdp TEXT NOT NULL,
|
||||||
created_at INTEGER NOT NULL,
|
created_at INTEGER NOT NULL,
|
||||||
expires_at INTEGER NOT NULL,
|
expires_at INTEGER NOT NULL,
|
||||||
|
last_seen INTEGER NOT NULL,
|
||||||
secret TEXT,
|
secret TEXT,
|
||||||
answerer_peer_id TEXT,
|
answerer_peer_id TEXT,
|
||||||
answer_sdp TEXT,
|
answer_sdp TEXT,
|
||||||
@@ -22,10 +23,10 @@ CREATE TABLE offers (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX idx_offers_peer ON offers(peer_id);
|
CREATE INDEX idx_offers_peer ON offers(peer_id);
|
||||||
CREATE INDEX idx_offers_service_fqn ON offers(service_fqn);
|
CREATE INDEX idx_offers_service ON offers(service_id);
|
||||||
CREATE INDEX idx_offers_expires ON offers(expires_at);
|
CREATE INDEX idx_offers_expires ON offers(expires_at);
|
||||||
|
CREATE INDEX idx_offers_last_seen ON offers(last_seen);
|
||||||
CREATE INDEX idx_offers_answerer ON offers(answerer_peer_id);
|
CREATE INDEX idx_offers_answerer ON offers(answerer_peer_id);
|
||||||
CREATE INDEX idx_offers_available ON offers(answerer_peer_id) WHERE answerer_peer_id IS NULL;
|
|
||||||
|
|
||||||
-- ICE candidates table
|
-- ICE candidates table
|
||||||
CREATE TABLE ice_candidates (
|
CREATE TABLE ice_candidates (
|
||||||
|
|||||||
Reference in New Issue
Block a user