mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-25 14:47:45 -06:00
Refactor database migrations and schema for Chat and Setting tables
- Removed the unique constraint on `remoteJid` and `instanceId` in the `Chat` model to prevent potential migration failures due to existing duplicates. - Deleted the old migration file for adding `wavoipToken` to the `Setting` table and created a new migration that includes a check for the column's existence before adding it, ensuring smoother migration processes. - Updated migration logic to clear previous migrations related to `wavoip_token` to maintain a clean migration history.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Chat` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
|
||||
-- Clear migrations
|
||||
DELETE FROM "_prisma_migrations" WHERE "migration_name" LIKE '%_add_wavoip_token_to_settings_table';
|
||||
-- AlterTable
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'Setting'
|
||||
AND column_name = 'wavoipToken'
|
||||
) THEN
|
||||
ALTER TABLE "Setting" ADD COLUMN "wavoipToken" VARCHAR(100);
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user