From 0aedee53d4940cb6b7d48066b19d64c979042bd7 Mon Sep 17 00:00:00 2001 From: augustolima1 <62573696+augustolima1@users.noreply.github.com> Date: Tue, 23 Dec 2025 09:55:22 -0300 Subject: [PATCH] fix: add migration to re-add lid column for existing installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../migration.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 prisma/mysql-migrations/20251223093839_re_add_lid_to_is_onwhatsapp/migration.sql diff --git a/prisma/mysql-migrations/20251223093839_re_add_lid_to_is_onwhatsapp/migration.sql b/prisma/mysql-migrations/20251223093839_re_add_lid_to_is_onwhatsapp/migration.sql new file mode 100644 index 00000000..1a6046d6 --- /dev/null +++ b/prisma/mysql-migrations/20251223093839_re_add_lid_to_is_onwhatsapp/migration.sql @@ -0,0 +1,21 @@ +-- Re-add lid column that was incorrectly dropped by previous migration +-- This migration ensures backward compatibility for existing installations + +-- Check if column exists before adding +SET @dbname = DATABASE(); +SET @tablename = 'IsOnWhatsapp'; +SET @columnname = 'lid'; +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE + (table_name = @tablename) + AND (table_schema = @dbname) + AND (column_name = @columnname) + ) > 0, + 'SELECT 1', + CONCAT('ALTER TABLE `', @tablename, '` ADD COLUMN `', @columnname, '` VARCHAR(100);') +)); +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists;