fix: add is_active column to users schema and migrations

- 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 <noreply@anthropic.com>
This commit is contained in:
soufiane 2025-12-04 00:51:19 +01:00
parent 89625e16f4
commit 62388bd92d
2 changed files with 7 additions and 0 deletions

View File

@ -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),

View File

@ -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 (