From 62388bd92dd45ee84601bb99b88bc67e21c249d5 Mon Sep 17 00:00:00 2001 From: soufiane Date: Thu, 4 Dec 2025 00:51:19 +0100 Subject: [PATCH] fix: add is_active column to users schema and migrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add is_active column to schema.sql for new deployments - Add migration in auto-init-db.js for existing databases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- database/schema.sql | 1 + scripts/auto-init-db.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/database/schema.sql b/database/schema.sql index fd311665..139ca351 100644 --- a/database/schema.sql +++ b/database/schema.sql @@ -42,6 +42,7 @@ CREATE TABLE users ( city VARCHAR(100), postal_code VARCHAR(10), role user_role DEFAULT 'CLIENT', + is_active BOOLEAN DEFAULT TRUE, is_verified BOOLEAN DEFAULT FALSE, verification_token VARCHAR(255), reset_token VARCHAR(255), diff --git a/scripts/auto-init-db.js b/scripts/auto-init-db.js index de1e419a..4a193aa8 100644 --- a/scripts/auto-init-db.js +++ b/scripts/auto-init-db.js @@ -217,6 +217,12 @@ async function applyMigrations() { console.log('🔄 Application des migrations...'); try { + // Add is_active column to users if not exists + await pool.query(` + ALTER TABLE users ADD COLUMN IF NOT EXISTS is_active BOOLEAN DEFAULT TRUE + `); + console.log(' ✅ Colonne is_active ajoutée à users'); + // Newsletter table await pool.query(` CREATE TABLE IF NOT EXISTS newsletters (