fix
This commit is contained in:
@@ -235,6 +235,45 @@ INSERT INTO lessons (title, description, type, video_url, video_platform, thumbn
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- ============================================
|
||||
-- MIGRAZIONE: CONVERSIONE VIDEO (9 Dicembre 2025)
|
||||
-- ============================================
|
||||
-- Aggiunge campo per tracciare conversione video in MP4 H.264
|
||||
|
||||
ALTER TABLE lessons
|
||||
ADD COLUMN IF NOT EXISTS video_converted BOOLEAN DEFAULT FALSE COMMENT 'True se il video è stato convertito in MP4 H.264'
|
||||
AFTER video_platform;
|
||||
|
||||
-- Aggiorna i video esistenti come non convertiti
|
||||
UPDATE lessons
|
||||
SET video_converted = FALSE
|
||||
WHERE type = 'video'
|
||||
AND video_platform = 'local'
|
||||
AND video_url IS NOT NULL
|
||||
AND (video_converted IS NULL OR video_converted = FALSE);
|
||||
|
||||
-- ============================================
|
||||
-- MIGRAZIONE: VERIFICA EMAIL (9 Dicembre 2025)
|
||||
-- ============================================
|
||||
-- Aggiunge campi per sistema di verifica email
|
||||
|
||||
-- Aggiungi campi per verifica email (se non esistono già)
|
||||
ALTER TABLE users
|
||||
ADD COLUMN IF NOT EXISTS email_verified BOOLEAN DEFAULT FALSE COMMENT 'True se email verificata' AFTER is_active,
|
||||
ADD COLUMN IF NOT EXISTS email_token VARCHAR(64) DEFAULT NULL COMMENT 'Token per verifica email' AFTER email_verified,
|
||||
ADD COLUMN IF NOT EXISTS email_token_expires DATETIME DEFAULT NULL COMMENT 'Scadenza token verifica email' AFTER email_token;
|
||||
|
||||
-- Aggiungi indici per performance (se non esistono già)
|
||||
ALTER TABLE users
|
||||
ADD INDEX IF NOT EXISTS idx_email_verified (email_verified),
|
||||
ADD INDEX IF NOT EXISTS idx_email_token (email_token);
|
||||
|
||||
-- Imposta tutti gli utenti esistenti come verificati (per retrocompatibilità)
|
||||
UPDATE users SET email_verified = TRUE WHERE email_verified = FALSE OR email_verified IS NULL;
|
||||
|
||||
-- Imposta admin come verificato
|
||||
UPDATE users SET email_verified = TRUE WHERE is_admin = TRUE;
|
||||
|
||||
-- ============================================
|
||||
-- FINE SCRIPT
|
||||
-- ============================================
|
||||
|
||||
Reference in New Issue
Block a user