mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-13 20: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:
@@ -337,11 +337,7 @@ export function createApp(storage: Storage, config: Config) {
|
||||
return c.json({ error: 'Invalid signature for username' }, 403);
|
||||
}
|
||||
|
||||
// Delete existing service if one exists (upsert behavior)
|
||||
const existingService = await storage.getServiceByFqn(serviceFqn);
|
||||
if (existingService) {
|
||||
await storage.deleteService(existingService.id, username);
|
||||
}
|
||||
// Note: createService handles upsert behavior (deletes existing service if it exists)
|
||||
|
||||
// Validate all offers
|
||||
for (const offer of offers) {
|
||||
|
||||
Reference in New Issue
Block a user