mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-11 19:33:25 +00:00
Fix UNIQUE constraint: Use (service_name, version, username) instead of service_fqn
- Change UNIQUE constraint to composite key on separate columns - Move upsert logic into D1Storage.createService() for atomic operation - Delete existing service and its offers before inserting new one - Remove redundant delete logic from app.ts endpoint - Fixes 'UNIQUE constraint failed: services.service_fqn' error when republishing
This commit is contained in:
@@ -68,7 +68,7 @@ CREATE TABLE services (
|
||||
created_at INTEGER NOT NULL,
|
||||
expires_at INTEGER NOT NULL,
|
||||
FOREIGN KEY (username) REFERENCES usernames(username) ON DELETE CASCADE,
|
||||
UNIQUE(service_fqn)
|
||||
UNIQUE(service_name, version, username)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_services_fqn ON services(service_fqn);
|
||||
|
||||
Reference in New Issue
Block a user