bug fix - route probleme
Dieser Commit ist enthalten in:
29
v2_adminpanel/fix_device_registrations.sql
Normale Datei
29
v2_adminpanel/fix_device_registrations.sql
Normale Datei
@@ -0,0 +1,29 @@
|
||||
-- Fixes für device_registrations Tabelle
|
||||
-- Diese Spalten fehlen und werden im Code verwendet
|
||||
|
||||
-- 1. Füge fehlende Spalten hinzu
|
||||
ALTER TABLE device_registrations
|
||||
ADD COLUMN IF NOT EXISTS device_type VARCHAR(50) DEFAULT 'unknown',
|
||||
ADD COLUMN IF NOT EXISTS license_key VARCHAR(60);
|
||||
|
||||
-- 2. Füge registration_date als Alias für first_seen hinzu
|
||||
-- (Oder nutze first_seen im Code)
|
||||
|
||||
-- 3. Fülle license_key aus licenses Tabelle
|
||||
UPDATE device_registrations dr
|
||||
SET license_key = l.license_key
|
||||
FROM licenses l
|
||||
WHERE dr.license_id = l.id
|
||||
AND dr.license_key IS NULL;
|
||||
|
||||
-- 4. Erstelle Index für license_key
|
||||
CREATE INDEX IF NOT EXISTS idx_device_license_key ON device_registrations(license_key);
|
||||
|
||||
-- 5. View für Kompatibilität
|
||||
CREATE OR REPLACE VIEW device_registrations_compat AS
|
||||
SELECT
|
||||
dr.*,
|
||||
dr.first_seen as registration_date,
|
||||
l.license_key as computed_license_key
|
||||
FROM device_registrations dr
|
||||
LEFT JOIN licenses l ON dr.license_id = l.id;
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren