Skip to content

Commit 0aedee5

Browse files
augustolima1claude
andcommitted
fix: add migration to re-add lid column for existing installations
Creates new migration to ensure lid column exists even in databases where it was previously dropped by the Kafka integration migration. Uses prepared statement to check column existence before adding, ensuring compatibility with both fresh and existing installations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent d6262ca commit 0aedee5

File tree

1 file changed

+21
-0
lines changed
  • prisma/mysql-migrations/20251223093839_re_add_lid_to_is_onwhatsapp

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Re-add lid column that was incorrectly dropped by previous migration
2+
-- This migration ensures backward compatibility for existing installations
3+
4+
-- Check if column exists before adding
5+
SET @dbname = DATABASE();
6+
SET @tablename = 'IsOnWhatsapp';
7+
SET @columnname = 'lid';
8+
SET @preparedStatement = (SELECT IF(
9+
(
10+
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
11+
WHERE
12+
(table_name = @tablename)
13+
AND (table_schema = @dbname)
14+
AND (column_name = @columnname)
15+
) > 0,
16+
'SELECT 1',
17+
CONCAT('ALTER TABLE `', @tablename, '` ADD COLUMN `', @columnname, '` VARCHAR(100);')
18+
));
19+
PREPARE alterIfNotExists FROM @preparedStatement;
20+
EXECUTE alterIfNotExists;
21+
DEALLOCATE PREPARE alterIfNotExists;

0 commit comments

Comments
 (0)