usofn8n commited on
Commit
f53e0e1
·
1 Parent(s): 1fa3142

Add Prisma schema file and update Dockerfile

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. docker-compose.dev.yaml +0 -35
  2. docker-compose.yaml +0 -68
  3. prisma/mysql-migrations/20240809105427_init/migration.sql +588 -0
  4. prisma/mysql-migrations/20240813153900_add_unique_index_for_remoted_jid_and_instance_in_contacts/migration.sql +173 -0
  5. prisma/mysql-migrations/20240814173138_add_ignore_jids_chatwoot/migration.sql +150 -0
  6. prisma/mysql-migrations/20240814214314_integrations_unification/migration.sql +208 -0
  7. prisma/mysql-migrations/20240821203259_add_postgres_migrations/migration.sql +269 -0
  8. prisma/mysql-migrations/20240824162012_add_type_on_integration_sessions/migration.sql +159 -0
  9. prisma/mysql-migrations/20240825131301_change_to_evolution_bot/migration.sql +219 -0
  10. prisma/mysql-migrations/20241001172800_add_message_status/migration.sql +174 -0
  11. prisma/mysql-migrations/20241108101333_fix_message_status_as_string/migration.sql +232 -0
  12. prisma/mysql-migrations/20250214181954_add_wavoip_token_column/migration.sql +175 -0
  13. prisma/mysql-migrations/20250225180031_add_nats_integration/migration.sql +17 -0
  14. prisma/mysql-migrations/20250510035200_add_wavoip_token_to_settings_table/migration.sql +26 -0
  15. prisma/mysql-migrations/20250514232744_add_n8n_table/migration.sql +62 -0
  16. prisma/mysql-migrations/20250515211815_add_evoai_table/migration.sql +61 -0
  17. prisma/mysql-migrations/20250516012152_remove_unique_atribute_for_file_name_in_media/migration.sql +2 -0
  18. prisma/mysql-migrations/20250612155048_add_coluns_trypebot_tables/migration.sql +7 -0
  19. prisma/mysql-migrations/20250613143000_add_lid_column_to_is_onwhatsapp/migration.sql +2 -0
  20. prisma/mysql-migrations/20250918183910_add_kafka_integration/migration.sql +231 -0
  21. prisma/mysql-migrations/migration_lock.toml +3 -0
  22. prisma/mysql-schema.prisma +757 -0
  23. prisma/postgresql-migrations/20240609181238_init/migration.sql +375 -0
  24. prisma/postgresql-migrations/20240610144159_create_column_profile_name_instance/migration.sql +2 -0
  25. prisma/postgresql-migrations/20240611125754_create_columns_whitelabel_chatwoot/migration.sql +3 -0
  26. prisma/postgresql-migrations/20240611202817_create_columns_debounce_time_typebot/migration.sql +5 -0
  27. prisma/postgresql-migrations/20240712144948_add_business_id_column_to_instances/migration.sql +2 -0
  28. prisma/postgresql-migrations/20240712150256_create_templates_table/migration.sql +21 -0
  29. prisma/postgresql-migrations/20240712155950_adjusts_in_templates_table/migration.sql +2 -0
  30. prisma/postgresql-migrations/20240712162206_remove_templates_table/migration.sql +11 -0
  31. prisma/postgresql-migrations/20240712223655_column_fallback_typebot/migration.sql +8 -0
  32. prisma/postgresql-migrations/20240712230631_column_ignore_jids_typebot/migration.sql +5 -0
  33. prisma/postgresql-migrations/20240713184337_add_media_table/migration.sql +24 -0
  34. prisma/postgresql-migrations/20240718121437_add_openai_tables/migration.sql +118 -0
  35. prisma/postgresql-migrations/20240718123923_adjusts_openai_tables/migration.sql +2 -0
  36. prisma/postgresql-migrations/20240722173259_add_name_column_to_openai_creds/migration.sql +12 -0
  37. prisma/postgresql-migrations/20240722173518_add_name_column_to_openai_creds/migration.sql +2 -0
  38. prisma/postgresql-migrations/20240723152648_adjusts_in_column_openai_creds/migration.sql +8 -0
  39. prisma/postgresql-migrations/20240723200254_add_webhookurl_on_message/migration.sql +2 -0
  40. prisma/postgresql-migrations/20240725184147_create_template_table/migration.sql +21 -0
  41. prisma/postgresql-migrations/20240725202651_add_webhook_url_template_table/migration.sql +2 -0
  42. prisma/postgresql-migrations/20240725221646_modify_token_instance_table/migration.sql +2 -0
  43. prisma/postgresql-migrations/20240729115127_modify_trigger_type_openai_typebot_table/migration.sql +2 -0
  44. prisma/postgresql-migrations/20240729180347_modify_typebot_session_status_openai_typebot_table/migration.sql +20 -0
  45. prisma/postgresql-migrations/20240730152156_create_dify_tables/migration.sql +103 -0
  46. prisma/postgresql-migrations/20240801193907_add_column_speech_to_text_openai_setting_table/migration.sql +2 -0
  47. prisma/postgresql-migrations/20240803163908_add_column_description_on_integrations_table/migration.sql +8 -0
  48. prisma/postgresql-migrations/20240808210239_add_column_function_url_openaibot_table/migration.sql +7 -0
  49. prisma/postgresql-migrations/20240811021156_add_chat_name_column/migration.sql +2 -0
  50. prisma/postgresql-migrations/20240811183328_add_unique_index_for_remoted_jid_and_instance_in_contacts/migration.sql +17 -0
docker-compose.dev.yaml DELETED
@@ -1,35 +0,0 @@
1
- services:
2
- api:
3
- container_name: evolution_api
4
- image: evolution/api:local
5
- build: .
6
- restart: always
7
- ports:
8
- - 8080:8080
9
- volumes:
10
- - evolution_instances:/evolution/instances
11
- networks:
12
- - evolution-net
13
- env_file:
14
- - .env
15
- expose:
16
- - 8080
17
-
18
- frontend:
19
- container_name: evolution_frontend
20
- image: evolution/manager:local
21
- build: ./evolution-manager-v2
22
- restart: always
23
- ports:
24
- - "3000:80"
25
- networks:
26
- - evolution-net
27
-
28
- volumes:
29
- evolution_instances:
30
-
31
-
32
- networks:
33
- evolution-net:
34
- name: evolution-net
35
- driver: bridge
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docker-compose.yaml DELETED
@@ -1,68 +0,0 @@
1
- version: "3.8"
2
-
3
- services:
4
- api:
5
- container_name: evolution_api
6
- image: evoapicloud/evolution-api:latest
7
- restart: always
8
- depends_on:
9
- - redis
10
- - evolution-postgres
11
- ports:
12
- - "8080:8080"
13
- volumes:
14
- - evolution_instances:/evolution/instances
15
- networks:
16
- - evolution-net
17
- env_file:
18
- - .env
19
- expose:
20
- - "8080"
21
-
22
- redis:
23
- container_name: evolution_redis
24
- image: redis:latest
25
- restart: always
26
- command: >
27
- redis-server --port 6379 --appendonly yes
28
- volumes:
29
- - evolution_redis:/data
30
- networks:
31
- evolution-net:
32
- aliases:
33
- - evolution-redis
34
- expose:
35
- - "6379"
36
-
37
- evolution-postgres:
38
- container_name: evolution_postgres
39
- image: postgres:15
40
- restart: always
41
- env_file:
42
- - .env
43
- command:
44
- - postgres
45
- - -c
46
- - max_connections=1000
47
- - -c
48
- - listen_addresses=*
49
- environment:
50
- - POSTGRES_DB=${POSTGRES_DATABASE}
51
- - POSTGRES_USER=${POSTGRES_USERNAME}
52
- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
53
- volumes:
54
- - postgres_data:/var/lib/postgresql/data
55
- networks:
56
- - evolution-net
57
- expose:
58
- - "5432"
59
-
60
- volumes:
61
- evolution_instances:
62
- evolution_redis:
63
- postgres_data:
64
-
65
- networks:
66
- evolution-net:
67
- name: evolution-net
68
- driver: bridge
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
prisma/mysql-migrations/20240809105427_init/migration.sql ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE `Instance` (
3
+ `id` VARCHAR(191) NOT NULL,
4
+ `name` VARCHAR(255) NOT NULL,
5
+ `connectionStatus` ENUM('open', 'close', 'connecting') NOT NULL DEFAULT 'open',
6
+ `ownerJid` VARCHAR(100) NULL,
7
+ `profileName` VARCHAR(100) NULL,
8
+ `profilePicUrl` VARCHAR(500) NULL,
9
+ `integration` VARCHAR(100) NULL,
10
+ `number` VARCHAR(100) NULL,
11
+ `businessId` VARCHAR(100) NULL,
12
+ `token` VARCHAR(255) NULL,
13
+ `clientName` VARCHAR(100) NULL,
14
+ `disconnectionReasonCode` INTEGER NULL,
15
+ `disconnectionObject` JSON NULL,
16
+ `disconnectionAt` TIMESTAMP NULL,
17
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
18
+ `updatedAt` TIMESTAMP NULL,
19
+
20
+ UNIQUE INDEX `Instance_name_key`(`name`),
21
+ PRIMARY KEY (`id`)
22
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
23
+
24
+ -- CreateTable
25
+ CREATE TABLE `Session` (
26
+ `id` VARCHAR(191) NOT NULL,
27
+ `sessionId` VARCHAR(191) NOT NULL,
28
+ `creds` TEXT NULL,
29
+ `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
30
+
31
+ UNIQUE INDEX `Session_sessionId_key`(`sessionId`),
32
+ PRIMARY KEY (`id`)
33
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
34
+
35
+ -- CreateTable
36
+ CREATE TABLE `Chat` (
37
+ `id` VARCHAR(191) NOT NULL,
38
+ `remoteJid` VARCHAR(100) NOT NULL,
39
+ `labels` JSON NULL,
40
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
41
+ `updatedAt` TIMESTAMP NULL,
42
+ `instanceId` VARCHAR(191) NOT NULL,
43
+
44
+ PRIMARY KEY (`id`)
45
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
46
+
47
+ -- CreateTable
48
+ CREATE TABLE `Contact` (
49
+ `id` VARCHAR(191) NOT NULL,
50
+ `remoteJid` VARCHAR(100) NOT NULL,
51
+ `pushName` VARCHAR(100) NULL,
52
+ `profilePicUrl` VARCHAR(500) NULL,
53
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
54
+ `updatedAt` TIMESTAMP NULL,
55
+ `instanceId` VARCHAR(191) NOT NULL,
56
+
57
+ PRIMARY KEY (`id`)
58
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
59
+
60
+ -- CreateTable
61
+ CREATE TABLE `Message` (
62
+ `id` VARCHAR(191) NOT NULL,
63
+ `key` JSON NOT NULL,
64
+ `pushName` VARCHAR(100) NULL,
65
+ `participant` VARCHAR(100) NULL,
66
+ `messageType` VARCHAR(100) NOT NULL,
67
+ `message` JSON NOT NULL,
68
+ `contextInfo` JSON NULL,
69
+ `source` ENUM('ios', 'android', 'web', 'unknown', 'desktop') NOT NULL,
70
+ `messageTimestamp` INTEGER NOT NULL,
71
+ `chatwootMessageId` INTEGER NULL,
72
+ `chatwootInboxId` INTEGER NULL,
73
+ `chatwootConversationId` INTEGER NULL,
74
+ `chatwootContactInboxSourceId` VARCHAR(100) NULL,
75
+ `chatwootIsRead` BOOLEAN NULL DEFAULT false,
76
+ `instanceId` VARCHAR(191) NOT NULL,
77
+ `typebotSessionId` VARCHAR(191) NULL,
78
+ `openaiSessionId` VARCHAR(191) NULL,
79
+ `webhookUrl` VARCHAR(500) NULL,
80
+ `difySessionId` VARCHAR(191) NULL,
81
+
82
+ PRIMARY KEY (`id`)
83
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
84
+
85
+ -- CreateTable
86
+ CREATE TABLE `MessageUpdate` (
87
+ `id` VARCHAR(191) NOT NULL,
88
+ `keyId` VARCHAR(100) NOT NULL,
89
+ `remoteJid` VARCHAR(100) NOT NULL,
90
+ `fromMe` BOOLEAN NOT NULL,
91
+ `participant` VARCHAR(100) NULL,
92
+ `pollUpdates` JSON NULL,
93
+ `status` VARCHAR(30) NOT NULL,
94
+ `messageId` VARCHAR(191) NOT NULL,
95
+ `instanceId` VARCHAR(191) NOT NULL,
96
+
97
+ PRIMARY KEY (`id`)
98
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
99
+
100
+ -- CreateTable
101
+ CREATE TABLE `Webhook` (
102
+ `id` VARCHAR(191) NOT NULL,
103
+ `url` VARCHAR(500) NOT NULL,
104
+ `enabled` BOOLEAN NULL DEFAULT true,
105
+ `events` JSON NULL,
106
+ `webhookByEvents` BOOLEAN NULL DEFAULT false,
107
+ `webhookBase64` BOOLEAN NULL DEFAULT false,
108
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
109
+ `updatedAt` TIMESTAMP NOT NULL,
110
+ `instanceId` VARCHAR(191) NOT NULL,
111
+
112
+ UNIQUE INDEX `Webhook_instanceId_key`(`instanceId`),
113
+ PRIMARY KEY (`id`)
114
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
115
+
116
+ -- CreateTable
117
+ CREATE TABLE `Chatwoot` (
118
+ `id` VARCHAR(191) NOT NULL,
119
+ `enabled` BOOLEAN NULL DEFAULT true,
120
+ `accountId` VARCHAR(100) NULL,
121
+ `token` VARCHAR(100) NULL,
122
+ `url` VARCHAR(500) NULL,
123
+ `nameInbox` VARCHAR(100) NULL,
124
+ `signMsg` BOOLEAN NULL DEFAULT false,
125
+ `signDelimiter` VARCHAR(100) NULL,
126
+ `number` VARCHAR(100) NULL,
127
+ `reopenConversation` BOOLEAN NULL DEFAULT false,
128
+ `conversationPending` BOOLEAN NULL DEFAULT false,
129
+ `mergeBrazilContacts` BOOLEAN NULL DEFAULT false,
130
+ `importContacts` BOOLEAN NULL DEFAULT false,
131
+ `importMessages` BOOLEAN NULL DEFAULT false,
132
+ `daysLimitImportMessages` INTEGER NULL,
133
+ `organization` VARCHAR(100) NULL,
134
+ `logo` VARCHAR(500) NULL,
135
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
136
+ `updatedAt` TIMESTAMP NOT NULL,
137
+ `instanceId` VARCHAR(191) NOT NULL,
138
+
139
+ UNIQUE INDEX `Chatwoot_instanceId_key`(`instanceId`),
140
+ PRIMARY KEY (`id`)
141
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
142
+
143
+ -- CreateTable
144
+ CREATE TABLE `Label` (
145
+ `id` VARCHAR(191) NOT NULL,
146
+ `labelId` VARCHAR(100) NULL,
147
+ `name` VARCHAR(100) NOT NULL,
148
+ `color` VARCHAR(100) NOT NULL,
149
+ `predefinedId` VARCHAR(100) NULL,
150
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
151
+ `updatedAt` TIMESTAMP NOT NULL,
152
+ `instanceId` VARCHAR(191) NOT NULL,
153
+
154
+ UNIQUE INDEX `Label_labelId_key`(`labelId`),
155
+ PRIMARY KEY (`id`)
156
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
157
+
158
+ -- CreateTable
159
+ CREATE TABLE `Proxy` (
160
+ `id` VARCHAR(191) NOT NULL,
161
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
162
+ `host` VARCHAR(100) NOT NULL,
163
+ `port` VARCHAR(100) NOT NULL,
164
+ `protocol` VARCHAR(100) NOT NULL,
165
+ `username` VARCHAR(100) NOT NULL,
166
+ `password` VARCHAR(100) NOT NULL,
167
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
168
+ `updatedAt` TIMESTAMP NOT NULL,
169
+ `instanceId` VARCHAR(191) NOT NULL,
170
+
171
+ UNIQUE INDEX `Proxy_instanceId_key`(`instanceId`),
172
+ PRIMARY KEY (`id`)
173
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
174
+
175
+ -- CreateTable
176
+ CREATE TABLE `Setting` (
177
+ `id` VARCHAR(191) NOT NULL,
178
+ `rejectCall` BOOLEAN NOT NULL DEFAULT false,
179
+ `msgCall` VARCHAR(100) NULL,
180
+ `groupsIgnore` BOOLEAN NOT NULL DEFAULT false,
181
+ `alwaysOnline` BOOLEAN NOT NULL DEFAULT false,
182
+ `readMessages` BOOLEAN NOT NULL DEFAULT false,
183
+ `readStatus` BOOLEAN NOT NULL DEFAULT false,
184
+ `syncFullHistory` BOOLEAN NOT NULL DEFAULT false,
185
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
186
+ `updatedAt` TIMESTAMP NOT NULL,
187
+ `instanceId` VARCHAR(191) NOT NULL,
188
+
189
+ UNIQUE INDEX `Setting_instanceId_key`(`instanceId`),
190
+ PRIMARY KEY (`id`)
191
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
192
+
193
+ -- CreateTable
194
+ CREATE TABLE `Rabbitmq` (
195
+ `id` VARCHAR(191) NOT NULL,
196
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
197
+ `events` JSON NOT NULL,
198
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
199
+ `updatedAt` TIMESTAMP NOT NULL,
200
+ `instanceId` VARCHAR(191) NOT NULL,
201
+
202
+ UNIQUE INDEX `Rabbitmq_instanceId_key`(`instanceId`),
203
+ PRIMARY KEY (`id`)
204
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
205
+
206
+ -- CreateTable
207
+ CREATE TABLE `Sqs` (
208
+ `id` VARCHAR(191) NOT NULL,
209
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
210
+ `events` JSON NOT NULL,
211
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
212
+ `updatedAt` TIMESTAMP NOT NULL,
213
+ `instanceId` VARCHAR(191) NOT NULL,
214
+
215
+ UNIQUE INDEX `Sqs_instanceId_key`(`instanceId`),
216
+ PRIMARY KEY (`id`)
217
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
218
+
219
+ -- CreateTable
220
+ CREATE TABLE `Websocket` (
221
+ `id` VARCHAR(191) NOT NULL,
222
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
223
+ `events` JSON NOT NULL,
224
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
225
+ `updatedAt` TIMESTAMP NOT NULL,
226
+ `instanceId` VARCHAR(191) NOT NULL,
227
+
228
+ UNIQUE INDEX `Websocket_instanceId_key`(`instanceId`),
229
+ PRIMARY KEY (`id`)
230
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
231
+
232
+ -- CreateTable
233
+ CREATE TABLE `Typebot` (
234
+ `id` VARCHAR(191) NOT NULL,
235
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
236
+ `description` VARCHAR(255) NULL,
237
+ `url` VARCHAR(500) NOT NULL,
238
+ `typebot` VARCHAR(100) NOT NULL,
239
+ `expire` INTEGER NULL DEFAULT 0,
240
+ `keywordFinish` VARCHAR(100) NULL,
241
+ `delayMessage` INTEGER NULL,
242
+ `unknownMessage` VARCHAR(100) NULL,
243
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
244
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
245
+ `keepOpen` BOOLEAN NULL DEFAULT false,
246
+ `debounceTime` INTEGER NULL,
247
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
248
+ `updatedAt` TIMESTAMP NULL,
249
+ `ignoreJids` JSON NULL,
250
+ `triggerType` ENUM('all', 'keyword', 'none') NULL,
251
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
252
+ `triggerValue` VARCHAR(191) NULL,
253
+ `instanceId` VARCHAR(191) NOT NULL,
254
+
255
+ PRIMARY KEY (`id`)
256
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
257
+
258
+ -- CreateTable
259
+ CREATE TABLE `TypebotSession` (
260
+ `id` VARCHAR(191) NOT NULL,
261
+ `remoteJid` VARCHAR(100) NOT NULL,
262
+ `pushName` VARCHAR(100) NULL,
263
+ `sessionId` VARCHAR(100) NOT NULL,
264
+ `status` ENUM('opened', 'closed', 'paused') NOT NULL,
265
+ `prefilledVariables` JSON NULL,
266
+ `awaitUser` BOOLEAN NOT NULL DEFAULT false,
267
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
268
+ `updatedAt` TIMESTAMP NOT NULL,
269
+ `typebotId` VARCHAR(191) NOT NULL,
270
+ `instanceId` VARCHAR(191) NOT NULL,
271
+
272
+ PRIMARY KEY (`id`)
273
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
274
+
275
+ -- CreateTable
276
+ CREATE TABLE `TypebotSetting` (
277
+ `id` VARCHAR(191) NOT NULL,
278
+ `expire` INTEGER NULL DEFAULT 0,
279
+ `keywordFinish` VARCHAR(100) NULL,
280
+ `delayMessage` INTEGER NULL,
281
+ `unknownMessage` VARCHAR(100) NULL,
282
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
283
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
284
+ `keepOpen` BOOLEAN NULL DEFAULT false,
285
+ `debounceTime` INTEGER NULL,
286
+ `typebotIdFallback` VARCHAR(100) NULL,
287
+ `ignoreJids` JSON NULL,
288
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
289
+ `updatedAt` TIMESTAMP NOT NULL,
290
+ `instanceId` VARCHAR(191) NOT NULL,
291
+
292
+ UNIQUE INDEX `TypebotSetting_instanceId_key`(`instanceId`),
293
+ PRIMARY KEY (`id`)
294
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
295
+
296
+ -- CreateTable
297
+ CREATE TABLE `Media` (
298
+ `id` VARCHAR(191) NOT NULL,
299
+ `fileName` VARCHAR(500) NOT NULL,
300
+ `type` VARCHAR(100) NOT NULL,
301
+ `mimetype` VARCHAR(100) NOT NULL,
302
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
303
+ `messageId` VARCHAR(191) NOT NULL,
304
+ `instanceId` VARCHAR(191) NOT NULL,
305
+
306
+ UNIQUE INDEX `Media_fileName_key`(`fileName`),
307
+ UNIQUE INDEX `Media_messageId_key`(`messageId`),
308
+ PRIMARY KEY (`id`)
309
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
310
+
311
+ -- CreateTable
312
+ CREATE TABLE `OpenaiCreds` (
313
+ `id` VARCHAR(191) NOT NULL,
314
+ `name` VARCHAR(255) NULL,
315
+ `apiKey` VARCHAR(255) NULL,
316
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
317
+ `updatedAt` TIMESTAMP NOT NULL,
318
+ `instanceId` VARCHAR(191) NOT NULL,
319
+
320
+ UNIQUE INDEX `OpenaiCreds_name_key`(`name`),
321
+ UNIQUE INDEX `OpenaiCreds_apiKey_key`(`apiKey`),
322
+ PRIMARY KEY (`id`)
323
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
324
+
325
+ -- CreateTable
326
+ CREATE TABLE `OpenaiBot` (
327
+ `id` VARCHAR(191) NOT NULL,
328
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
329
+ `description` VARCHAR(255) NULL,
330
+ `botType` ENUM('assistant', 'chatCompletion') NOT NULL,
331
+ `assistantId` VARCHAR(255) NULL,
332
+ `functionUrl` VARCHAR(500) NULL,
333
+ `model` VARCHAR(100) NULL,
334
+ `systemMessages` JSON NULL,
335
+ `assistantMessages` JSON NULL,
336
+ `userMessages` JSON NULL,
337
+ `maxTokens` INTEGER NULL,
338
+ `expire` INTEGER NULL DEFAULT 0,
339
+ `keywordFinish` VARCHAR(100) NULL,
340
+ `delayMessage` INTEGER NULL,
341
+ `unknownMessage` VARCHAR(100) NULL,
342
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
343
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
344
+ `keepOpen` BOOLEAN NULL DEFAULT false,
345
+ `debounceTime` INTEGER NULL,
346
+ `ignoreJids` JSON NULL,
347
+ `triggerType` ENUM('all', 'keyword', 'none') NULL,
348
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
349
+ `triggerValue` VARCHAR(191) NULL,
350
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
351
+ `updatedAt` TIMESTAMP NOT NULL,
352
+ `openaiCredsId` VARCHAR(191) NOT NULL,
353
+ `instanceId` VARCHAR(191) NOT NULL,
354
+
355
+ PRIMARY KEY (`id`)
356
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
357
+
358
+ -- CreateTable
359
+ CREATE TABLE `OpenaiSession` (
360
+ `id` VARCHAR(191) NOT NULL,
361
+ `sessionId` VARCHAR(255) NOT NULL,
362
+ `remoteJid` VARCHAR(100) NOT NULL,
363
+ `status` ENUM('opened', 'closed', 'paused') NOT NULL,
364
+ `awaitUser` BOOLEAN NOT NULL DEFAULT false,
365
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
366
+ `updatedAt` TIMESTAMP NOT NULL,
367
+ `openaiBotId` VARCHAR(191) NOT NULL,
368
+ `instanceId` VARCHAR(191) NOT NULL,
369
+
370
+ PRIMARY KEY (`id`)
371
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
372
+
373
+ -- CreateTable
374
+ CREATE TABLE `OpenaiSetting` (
375
+ `id` VARCHAR(191) NOT NULL,
376
+ `expire` INTEGER NULL DEFAULT 0,
377
+ `keywordFinish` VARCHAR(100) NULL,
378
+ `delayMessage` INTEGER NULL,
379
+ `unknownMessage` VARCHAR(100) NULL,
380
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
381
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
382
+ `keepOpen` BOOLEAN NULL DEFAULT false,
383
+ `debounceTime` INTEGER NULL,
384
+ `ignoreJids` JSON NULL,
385
+ `speechToText` BOOLEAN NULL DEFAULT false,
386
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
387
+ `updatedAt` TIMESTAMP NOT NULL,
388
+ `openaiCredsId` VARCHAR(191) NOT NULL,
389
+ `openaiIdFallback` VARCHAR(100) NULL,
390
+ `instanceId` VARCHAR(191) NOT NULL,
391
+
392
+ UNIQUE INDEX `OpenaiSetting_openaiCredsId_key`(`openaiCredsId`),
393
+ UNIQUE INDEX `OpenaiSetting_instanceId_key`(`instanceId`),
394
+ PRIMARY KEY (`id`)
395
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
396
+
397
+ -- CreateTable
398
+ CREATE TABLE `Template` (
399
+ `id` VARCHAR(191) NOT NULL,
400
+ `templateId` VARCHAR(255) NOT NULL,
401
+ `name` VARCHAR(255) NOT NULL,
402
+ `template` JSON NOT NULL,
403
+ `webhookUrl` VARCHAR(500) NULL,
404
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
405
+ `updatedAt` TIMESTAMP NOT NULL,
406
+ `instanceId` VARCHAR(191) NOT NULL,
407
+
408
+ UNIQUE INDEX `Template_templateId_key`(`templateId`),
409
+ UNIQUE INDEX `Template_name_key`(`name`),
410
+ PRIMARY KEY (`id`)
411
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
412
+
413
+ -- CreateTable
414
+ CREATE TABLE `Dify` (
415
+ `id` VARCHAR(191) NOT NULL,
416
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
417
+ `description` VARCHAR(255) NULL,
418
+ `botType` ENUM('chatBot', 'textGenerator', 'agent', 'workflow') NOT NULL,
419
+ `apiUrl` VARCHAR(255) NULL,
420
+ `apiKey` VARCHAR(255) NULL,
421
+ `expire` INTEGER NULL DEFAULT 0,
422
+ `keywordFinish` VARCHAR(100) NULL,
423
+ `delayMessage` INTEGER NULL,
424
+ `unknownMessage` VARCHAR(100) NULL,
425
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
426
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
427
+ `keepOpen` BOOLEAN NULL DEFAULT false,
428
+ `debounceTime` INTEGER NULL,
429
+ `ignoreJids` JSON NULL,
430
+ `triggerType` ENUM('all', 'keyword', 'none') NULL,
431
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
432
+ `triggerValue` VARCHAR(191) NULL,
433
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
434
+ `updatedAt` TIMESTAMP NOT NULL,
435
+ `instanceId` VARCHAR(191) NOT NULL,
436
+
437
+ PRIMARY KEY (`id`)
438
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
439
+
440
+ -- CreateTable
441
+ CREATE TABLE `DifySession` (
442
+ `id` VARCHAR(191) NOT NULL,
443
+ `sessionId` VARCHAR(255) NOT NULL,
444
+ `remoteJid` VARCHAR(100) NOT NULL,
445
+ `status` ENUM('opened', 'closed', 'paused') NOT NULL,
446
+ `awaitUser` BOOLEAN NOT NULL DEFAULT false,
447
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
448
+ `updatedAt` TIMESTAMP NOT NULL,
449
+ `difyId` VARCHAR(191) NOT NULL,
450
+ `instanceId` VARCHAR(191) NOT NULL,
451
+
452
+ PRIMARY KEY (`id`)
453
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
454
+
455
+ -- CreateTable
456
+ CREATE TABLE `DifySetting` (
457
+ `id` VARCHAR(191) NOT NULL,
458
+ `expire` INTEGER NULL DEFAULT 0,
459
+ `keywordFinish` VARCHAR(100) NULL,
460
+ `delayMessage` INTEGER NULL,
461
+ `unknownMessage` VARCHAR(100) NULL,
462
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
463
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
464
+ `keepOpen` BOOLEAN NULL DEFAULT false,
465
+ `debounceTime` INTEGER NULL,
466
+ `ignoreJids` JSON NULL,
467
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
468
+ `updatedAt` TIMESTAMP NOT NULL,
469
+ `difyIdFallback` VARCHAR(100) NULL,
470
+ `instanceId` VARCHAR(191) NOT NULL,
471
+
472
+ UNIQUE INDEX `DifySetting_instanceId_key`(`instanceId`),
473
+ PRIMARY KEY (`id`)
474
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
475
+
476
+ -- AddForeignKey
477
+ ALTER TABLE `Session` ADD CONSTRAINT `Session_sessionId_fkey` FOREIGN KEY (`sessionId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
478
+
479
+ -- AddForeignKey
480
+ ALTER TABLE `Chat` ADD CONSTRAINT `Chat_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
481
+
482
+ -- AddForeignKey
483
+ ALTER TABLE `Contact` ADD CONSTRAINT `Contact_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
484
+
485
+ -- AddForeignKey
486
+ ALTER TABLE `Message` ADD CONSTRAINT `Message_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
487
+
488
+ -- AddForeignKey
489
+ ALTER TABLE `Message` ADD CONSTRAINT `Message_typebotSessionId_fkey` FOREIGN KEY (`typebotSessionId`) REFERENCES `TypebotSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
490
+
491
+ -- AddForeignKey
492
+ ALTER TABLE `Message` ADD CONSTRAINT `Message_openaiSessionId_fkey` FOREIGN KEY (`openaiSessionId`) REFERENCES `OpenaiSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
493
+
494
+ -- AddForeignKey
495
+ ALTER TABLE `Message` ADD CONSTRAINT `Message_difySessionId_fkey` FOREIGN KEY (`difySessionId`) REFERENCES `DifySession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
496
+
497
+ -- AddForeignKey
498
+ ALTER TABLE `MessageUpdate` ADD CONSTRAINT `MessageUpdate_messageId_fkey` FOREIGN KEY (`messageId`) REFERENCES `Message`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
499
+
500
+ -- AddForeignKey
501
+ ALTER TABLE `MessageUpdate` ADD CONSTRAINT `MessageUpdate_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
502
+
503
+ -- AddForeignKey
504
+ ALTER TABLE `Webhook` ADD CONSTRAINT `Webhook_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
505
+
506
+ -- AddForeignKey
507
+ ALTER TABLE `Chatwoot` ADD CONSTRAINT `Chatwoot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
508
+
509
+ -- AddForeignKey
510
+ ALTER TABLE `Label` ADD CONSTRAINT `Label_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
511
+
512
+ -- AddForeignKey
513
+ ALTER TABLE `Proxy` ADD CONSTRAINT `Proxy_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
514
+
515
+ -- AddForeignKey
516
+ ALTER TABLE `Setting` ADD CONSTRAINT `Setting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
517
+
518
+ -- AddForeignKey
519
+ ALTER TABLE `Rabbitmq` ADD CONSTRAINT `Rabbitmq_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
520
+
521
+ -- AddForeignKey
522
+ ALTER TABLE `Sqs` ADD CONSTRAINT `Sqs_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
523
+
524
+ -- AddForeignKey
525
+ ALTER TABLE `Websocket` ADD CONSTRAINT `Websocket_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
526
+
527
+ -- AddForeignKey
528
+ ALTER TABLE `Typebot` ADD CONSTRAINT `Typebot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
529
+
530
+ -- AddForeignKey
531
+ ALTER TABLE `TypebotSession` ADD CONSTRAINT `TypebotSession_typebotId_fkey` FOREIGN KEY (`typebotId`) REFERENCES `Typebot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
532
+
533
+ -- AddForeignKey
534
+ ALTER TABLE `TypebotSession` ADD CONSTRAINT `TypebotSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
535
+
536
+ -- AddForeignKey
537
+ ALTER TABLE `TypebotSetting` ADD CONSTRAINT `TypebotSetting_typebotIdFallback_fkey` FOREIGN KEY (`typebotIdFallback`) REFERENCES `Typebot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
538
+
539
+ -- AddForeignKey
540
+ ALTER TABLE `TypebotSetting` ADD CONSTRAINT `TypebotSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
541
+
542
+ -- AddForeignKey
543
+ ALTER TABLE `Media` ADD CONSTRAINT `Media_messageId_fkey` FOREIGN KEY (`messageId`) REFERENCES `Message`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
544
+
545
+ -- AddForeignKey
546
+ ALTER TABLE `Media` ADD CONSTRAINT `Media_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
547
+
548
+ -- AddForeignKey
549
+ ALTER TABLE `OpenaiCreds` ADD CONSTRAINT `OpenaiCreds_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
550
+
551
+ -- AddForeignKey
552
+ ALTER TABLE `OpenaiBot` ADD CONSTRAINT `OpenaiBot_openaiCredsId_fkey` FOREIGN KEY (`openaiCredsId`) REFERENCES `OpenaiCreds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
553
+
554
+ -- AddForeignKey
555
+ ALTER TABLE `OpenaiBot` ADD CONSTRAINT `OpenaiBot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
556
+
557
+ -- AddForeignKey
558
+ ALTER TABLE `OpenaiSession` ADD CONSTRAINT `OpenaiSession_openaiBotId_fkey` FOREIGN KEY (`openaiBotId`) REFERENCES `OpenaiBot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
559
+
560
+ -- AddForeignKey
561
+ ALTER TABLE `OpenaiSession` ADD CONSTRAINT `OpenaiSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
562
+
563
+ -- AddForeignKey
564
+ ALTER TABLE `OpenaiSetting` ADD CONSTRAINT `OpenaiSetting_openaiCredsId_fkey` FOREIGN KEY (`openaiCredsId`) REFERENCES `OpenaiCreds`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
565
+
566
+ -- AddForeignKey
567
+ ALTER TABLE `OpenaiSetting` ADD CONSTRAINT `OpenaiSetting_openaiIdFallback_fkey` FOREIGN KEY (`openaiIdFallback`) REFERENCES `OpenaiBot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
568
+
569
+ -- AddForeignKey
570
+ ALTER TABLE `OpenaiSetting` ADD CONSTRAINT `OpenaiSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
571
+
572
+ -- AddForeignKey
573
+ ALTER TABLE `Template` ADD CONSTRAINT `Template_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
574
+
575
+ -- AddForeignKey
576
+ ALTER TABLE `Dify` ADD CONSTRAINT `Dify_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
577
+
578
+ -- AddForeignKey
579
+ ALTER TABLE `DifySession` ADD CONSTRAINT `DifySession_difyId_fkey` FOREIGN KEY (`difyId`) REFERENCES `Dify`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
580
+
581
+ -- AddForeignKey
582
+ ALTER TABLE `DifySession` ADD CONSTRAINT `DifySession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
583
+
584
+ -- AddForeignKey
585
+ ALTER TABLE `DifySetting` ADD CONSTRAINT `DifySetting_difyIdFallback_fkey` FOREIGN KEY (`difyIdFallback`) REFERENCES `Dify`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
586
+
587
+ -- AddForeignKey
588
+ ALTER TABLE `DifySetting` ADD CONSTRAINT `DifySetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20240813153900_add_unique_index_for_remoted_jid_and_instance_in_contacts/migration.sql ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
4
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `createdAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `updatedAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `updatedAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `createdAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `updatedAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Contact` will be added. If there are existing duplicate values, this will fail.
51
+ */
52
+ -- AlterTable
53
+ ALTER TABLE `Chat`
54
+ ADD COLUMN `name` VARCHAR(100) NULL,
55
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
56
+ MODIFY `updatedAt` TIMESTAMP NULL;
57
+
58
+ -- AlterTable
59
+ ALTER TABLE `Chatwoot`
60
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
61
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
62
+
63
+ -- AlterTable
64
+ ALTER TABLE `Contact`
65
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
66
+ MODIFY `updatedAt` TIMESTAMP NULL;
67
+
68
+ -- AlterTable
69
+ ALTER TABLE `Dify`
70
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
71
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
72
+
73
+ -- AlterTable
74
+ ALTER TABLE `DifySession`
75
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
76
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
77
+
78
+ -- AlterTable
79
+ ALTER TABLE `DifySetting`
80
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
81
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
82
+
83
+ -- AlterTable
84
+ ALTER TABLE `Instance`
85
+ MODIFY `disconnectionAt` TIMESTAMP NULL,
86
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
87
+ MODIFY `updatedAt` TIMESTAMP NULL;
88
+
89
+ -- AlterTable
90
+ ALTER TABLE `Label`
91
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
92
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
93
+
94
+ -- AlterTable
95
+ ALTER TABLE `Media`
96
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
97
+
98
+ -- AlterTable
99
+ ALTER TABLE `OpenaiBot`
100
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
101
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
102
+
103
+ -- AlterTable
104
+ ALTER TABLE `OpenaiCreds`
105
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
106
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
107
+
108
+ -- AlterTable
109
+ ALTER TABLE `OpenaiSession`
110
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
111
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
112
+
113
+ -- AlterTable
114
+ ALTER TABLE `OpenaiSetting`
115
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
116
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
117
+
118
+ -- AlterTable
119
+ ALTER TABLE `Proxy`
120
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
121
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
122
+
123
+ -- AlterTable
124
+ ALTER TABLE `Rabbitmq`
125
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
126
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
127
+
128
+ -- AlterTable
129
+ ALTER TABLE `Session`
130
+ MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
131
+
132
+ -- AlterTable
133
+ ALTER TABLE `Setting`
134
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
135
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
136
+
137
+ -- AlterTable
138
+ ALTER TABLE `Sqs`
139
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
140
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
141
+
142
+ -- AlterTable
143
+ ALTER TABLE `Template`
144
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
145
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
146
+
147
+ -- AlterTable
148
+ ALTER TABLE `Typebot`
149
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
150
+ MODIFY `updatedAt` TIMESTAMP NULL;
151
+
152
+ -- AlterTable
153
+ ALTER TABLE `TypebotSession`
154
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
155
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
156
+
157
+ -- AlterTable
158
+ ALTER TABLE `TypebotSetting`
159
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
160
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
161
+
162
+ -- AlterTable
163
+ ALTER TABLE `Webhook`
164
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
165
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
166
+
167
+ -- AlterTable
168
+ ALTER TABLE `Websocket`
169
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
170
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
171
+
172
+ -- CreateIndex
173
+ CREATE UNIQUE INDEX `Contact_remoteJid_instanceId_key` ON `Contact` (`remoteJid`, `instanceId`);
prisma/mysql-migrations/20240814173138_add_ignore_jids_chatwoot/migration.sql ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `createdAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `updatedAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+
52
+ */
53
+ -- DropIndex
54
+ DROP INDEX `Label_labelId_key` ON `Label`;
55
+
56
+ -- AlterTable
57
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
58
+ MODIFY `updatedAt` TIMESTAMP NULL;
59
+
60
+ -- AlterTable
61
+ ALTER TABLE `Chatwoot` ADD COLUMN `ignoreJids` JSON NULL,
62
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
63
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
64
+
65
+ -- AlterTable
66
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
67
+ MODIFY `updatedAt` TIMESTAMP NULL;
68
+
69
+ -- AlterTable
70
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
71
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
72
+
73
+ -- AlterTable
74
+ ALTER TABLE `DifySession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
75
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
76
+
77
+ -- AlterTable
78
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
79
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
80
+
81
+ -- AlterTable
82
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
83
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
84
+ MODIFY `updatedAt` TIMESTAMP NULL;
85
+
86
+ -- AlterTable
87
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
88
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
89
+
90
+ -- AlterTable
91
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
92
+
93
+ -- AlterTable
94
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
95
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
96
+
97
+ -- AlterTable
98
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
99
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
100
+
101
+ -- AlterTable
102
+ ALTER TABLE `OpenaiSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
103
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
104
+
105
+ -- AlterTable
106
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
107
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
108
+
109
+ -- AlterTable
110
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
111
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
112
+
113
+ -- AlterTable
114
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
115
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
116
+
117
+ -- AlterTable
118
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
119
+
120
+ -- AlterTable
121
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
122
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
123
+
124
+ -- AlterTable
125
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
126
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
127
+
128
+ -- AlterTable
129
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
130
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
131
+
132
+ -- AlterTable
133
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
134
+ MODIFY `updatedAt` TIMESTAMP NULL;
135
+
136
+ -- AlterTable
137
+ ALTER TABLE `TypebotSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
138
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
139
+
140
+ -- AlterTable
141
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
142
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
143
+
144
+ -- AlterTable
145
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
146
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
147
+
148
+ -- AlterTable
149
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
150
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
prisma/mysql-migrations/20240814214314_integrations_unification/migration.sql ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to drop the column `difySessionId` on the `Message` table. All the data in the column will be lost.
21
+ - You are about to drop the column `openaiSessionId` on the `Message` table. All the data in the column will be lost.
22
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to drop the `DifySession` table. If the table is not empty, all the data it contains will be lost.
48
+ - You are about to drop the `OpenaiSession` table. If the table is not empty, all the data it contains will be lost.
49
+ - You are about to drop the `TypebotSession` table. If the table is not empty, all the data it contains will be lost.
50
+
51
+ */
52
+ -- DropForeignKey
53
+ ALTER TABLE `DifySession` DROP FOREIGN KEY `DifySession_difyId_fkey`;
54
+
55
+ -- DropForeignKey
56
+ ALTER TABLE `DifySession` DROP FOREIGN KEY `DifySession_instanceId_fkey`;
57
+
58
+ -- DropForeignKey
59
+ ALTER TABLE `Message` DROP FOREIGN KEY `Message_difySessionId_fkey`;
60
+
61
+ -- DropForeignKey
62
+ ALTER TABLE `Message` DROP FOREIGN KEY `Message_openaiSessionId_fkey`;
63
+
64
+ -- DropForeignKey
65
+ ALTER TABLE `Message` DROP FOREIGN KEY `Message_typebotSessionId_fkey`;
66
+
67
+ -- DropForeignKey
68
+ ALTER TABLE `OpenaiSession` DROP FOREIGN KEY `OpenaiSession_instanceId_fkey`;
69
+
70
+ -- DropForeignKey
71
+ ALTER TABLE `OpenaiSession` DROP FOREIGN KEY `OpenaiSession_openaiBotId_fkey`;
72
+
73
+ -- DropForeignKey
74
+ ALTER TABLE `TypebotSession` DROP FOREIGN KEY `TypebotSession_instanceId_fkey`;
75
+
76
+ -- DropForeignKey
77
+ ALTER TABLE `TypebotSession` DROP FOREIGN KEY `TypebotSession_typebotId_fkey`;
78
+
79
+ -- AlterTable
80
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
81
+ MODIFY `updatedAt` TIMESTAMP NULL;
82
+
83
+ -- AlterTable
84
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
85
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
86
+
87
+ -- AlterTable
88
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
89
+ MODIFY `updatedAt` TIMESTAMP NULL;
90
+
91
+ -- AlterTable
92
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
93
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
94
+
95
+ -- AlterTable
96
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
97
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
98
+
99
+ -- AlterTable
100
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
101
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
102
+ MODIFY `updatedAt` TIMESTAMP NULL;
103
+
104
+ -- AlterTable
105
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
106
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
107
+
108
+ -- AlterTable
109
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
110
+
111
+ -- AlterTable
112
+ ALTER TABLE `Message` DROP COLUMN `difySessionId`,
113
+ DROP COLUMN `openaiSessionId`,
114
+ ADD COLUMN `sessionId` VARCHAR(191) NULL;
115
+
116
+ -- AlterTable
117
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
118
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
119
+
120
+ -- AlterTable
121
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
122
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
123
+
124
+ -- AlterTable
125
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
126
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
127
+
128
+ -- AlterTable
129
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
130
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
131
+
132
+ -- AlterTable
133
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
134
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
135
+
136
+ -- AlterTable
137
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
138
+
139
+ -- AlterTable
140
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
141
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
142
+
143
+ -- AlterTable
144
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
145
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
146
+
147
+ -- AlterTable
148
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
149
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
150
+
151
+ -- AlterTable
152
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
153
+ MODIFY `updatedAt` TIMESTAMP NULL;
154
+
155
+ -- AlterTable
156
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
157
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
158
+
159
+ -- AlterTable
160
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
161
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
162
+
163
+ -- AlterTable
164
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
165
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
166
+
167
+ -- DropTable
168
+ DROP TABLE `DifySession`;
169
+
170
+ -- DropTable
171
+ DROP TABLE `OpenaiSession`;
172
+
173
+ -- DropTable
174
+ DROP TABLE `TypebotSession`;
175
+
176
+ -- CreateTable
177
+ CREATE TABLE `IntegrationSession` (
178
+ `id` VARCHAR(191) NOT NULL,
179
+ `sessionId` VARCHAR(255) NOT NULL,
180
+ `remoteJid` VARCHAR(100) NOT NULL,
181
+ `pushName` VARCHAR(191) NULL,
182
+ `status` ENUM('opened', 'closed', 'paused') NOT NULL,
183
+ `awaitUser` BOOLEAN NOT NULL DEFAULT false,
184
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
185
+ `updatedAt` TIMESTAMP NOT NULL,
186
+ `instanceId` VARCHAR(191) NOT NULL,
187
+ `parameters` JSON NULL,
188
+ `openaiBotId` VARCHAR(191) NULL,
189
+ `difyId` VARCHAR(191) NULL,
190
+ `typebotId` VARCHAR(191) NULL,
191
+
192
+ PRIMARY KEY (`id`)
193
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
194
+
195
+ -- AddForeignKey
196
+ ALTER TABLE `Message` ADD CONSTRAINT `Message_sessionId_fkey` FOREIGN KEY (`sessionId`) REFERENCES `IntegrationSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
197
+
198
+ -- AddForeignKey
199
+ ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
200
+
201
+ -- AddForeignKey
202
+ ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_openaiBotId_fkey` FOREIGN KEY (`openaiBotId`) REFERENCES `OpenaiBot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
203
+
204
+ -- AddForeignKey
205
+ ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_difyId_fkey` FOREIGN KEY (`difyId`) REFERENCES `Dify`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
206
+
207
+ -- AddForeignKey
208
+ ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_typebotId_fkey` FOREIGN KEY (`typebotId`) REFERENCES `Typebot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20240821203259_add_postgres_migrations/migration.sql ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to drop the column `difyId` on the `IntegrationSession` table. All the data in the column will be lost.
18
+ - You are about to drop the column `openaiBotId` on the `IntegrationSession` table. All the data in the column will be lost.
19
+ - You are about to drop the column `typebotId` on the `IntegrationSession` table. All the data in the column will be lost.
20
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+
51
+ */
52
+ -- DropForeignKey
53
+ ALTER TABLE `IntegrationSession` DROP FOREIGN KEY `IntegrationSession_difyId_fkey`;
54
+
55
+ -- DropForeignKey
56
+ ALTER TABLE `IntegrationSession` DROP FOREIGN KEY `IntegrationSession_openaiBotId_fkey`;
57
+
58
+ -- DropForeignKey
59
+ ALTER TABLE `IntegrationSession` DROP FOREIGN KEY `IntegrationSession_typebotId_fkey`;
60
+
61
+ -- DropIndex
62
+ DROP INDEX `Message_typebotSessionId_fkey` ON `Message`;
63
+
64
+ -- AlterTable
65
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
66
+ MODIFY `updatedAt` TIMESTAMP NULL;
67
+
68
+ -- AlterTable
69
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
70
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
71
+
72
+ -- AlterTable
73
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
74
+ MODIFY `updatedAt` TIMESTAMP NULL;
75
+
76
+ -- AlterTable
77
+ ALTER TABLE `Dify` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
78
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
79
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
80
+
81
+ -- AlterTable
82
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
83
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
84
+
85
+ -- AlterTable
86
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
87
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
88
+ MODIFY `updatedAt` TIMESTAMP NULL;
89
+
90
+ -- AlterTable
91
+ ALTER TABLE `IntegrationSession` DROP COLUMN `difyId`,
92
+ DROP COLUMN `openaiBotId`,
93
+ DROP COLUMN `typebotId`,
94
+ ADD COLUMN `botId` VARCHAR(191) NULL,
95
+ ADD COLUMN `context` JSON NULL,
96
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
97
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
98
+
99
+ -- AlterTable
100
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
101
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
102
+
103
+ -- AlterTable
104
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
105
+
106
+ -- AlterTable
107
+ ALTER TABLE `OpenaiBot` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
108
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
109
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
110
+
111
+ -- AlterTable
112
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
113
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
114
+
115
+ -- AlterTable
116
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
117
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
118
+
119
+ -- AlterTable
120
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
121
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
122
+
123
+ -- AlterTable
124
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
125
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
126
+
127
+ -- AlterTable
128
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
129
+
130
+ -- AlterTable
131
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
132
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
133
+
134
+ -- AlterTable
135
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
136
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
137
+
138
+ -- AlterTable
139
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
140
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
141
+
142
+ -- AlterTable
143
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
144
+ MODIFY `updatedAt` TIMESTAMP NULL,
145
+ MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL;
146
+
147
+ -- AlterTable
148
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
149
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
150
+
151
+ -- AlterTable
152
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
153
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
154
+
155
+ -- AlterTable
156
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
157
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
158
+
159
+ -- CreateTable
160
+ CREATE TABLE `GenericBot` (
161
+ `id` VARCHAR(191) NOT NULL,
162
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
163
+ `description` VARCHAR(255) NULL,
164
+ `apiUrl` VARCHAR(255) NULL,
165
+ `apiKey` VARCHAR(255) NULL,
166
+ `expire` INTEGER NULL DEFAULT 0,
167
+ `keywordFinish` VARCHAR(100) NULL,
168
+ `delayMessage` INTEGER NULL,
169
+ `unknownMessage` VARCHAR(100) NULL,
170
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
171
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
172
+ `keepOpen` BOOLEAN NULL DEFAULT false,
173
+ `debounceTime` INTEGER NULL,
174
+ `ignoreJids` JSON NULL,
175
+ `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
176
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
177
+ `triggerValue` VARCHAR(191) NULL,
178
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
179
+ `updatedAt` TIMESTAMP NOT NULL,
180
+ `instanceId` VARCHAR(191) NOT NULL,
181
+
182
+ PRIMARY KEY (`id`)
183
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
184
+
185
+ -- CreateTable
186
+ CREATE TABLE `GenericSetting` (
187
+ `id` VARCHAR(191) NOT NULL,
188
+ `expire` INTEGER NULL DEFAULT 0,
189
+ `keywordFinish` VARCHAR(100) NULL,
190
+ `delayMessage` INTEGER NULL,
191
+ `unknownMessage` VARCHAR(100) NULL,
192
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
193
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
194
+ `keepOpen` BOOLEAN NULL DEFAULT false,
195
+ `debounceTime` INTEGER NULL,
196
+ `ignoreJids` JSON NULL,
197
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
198
+ `updatedAt` TIMESTAMP NOT NULL,
199
+ `botIdFallback` VARCHAR(100) NULL,
200
+ `instanceId` VARCHAR(191) NOT NULL,
201
+
202
+ UNIQUE INDEX `GenericSetting_instanceId_key`(`instanceId`),
203
+ PRIMARY KEY (`id`)
204
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
205
+
206
+ -- CreateTable
207
+ CREATE TABLE `Flowise` (
208
+ `id` VARCHAR(191) NOT NULL,
209
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
210
+ `description` VARCHAR(255) NULL,
211
+ `apiUrl` VARCHAR(255) NULL,
212
+ `apiKey` VARCHAR(255) NULL,
213
+ `expire` INTEGER NULL DEFAULT 0,
214
+ `keywordFinish` VARCHAR(100) NULL,
215
+ `delayMessage` INTEGER NULL,
216
+ `unknownMessage` VARCHAR(100) NULL,
217
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
218
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
219
+ `keepOpen` BOOLEAN NULL DEFAULT false,
220
+ `debounceTime` INTEGER NULL,
221
+ `ignoreJids` JSON NULL,
222
+ `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
223
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
224
+ `triggerValue` VARCHAR(191) NULL,
225
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
226
+ `updatedAt` TIMESTAMP NOT NULL,
227
+ `instanceId` VARCHAR(191) NOT NULL,
228
+
229
+ PRIMARY KEY (`id`)
230
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
231
+
232
+ -- CreateTable
233
+ CREATE TABLE `FlowiseSetting` (
234
+ `id` VARCHAR(191) NOT NULL,
235
+ `expire` INTEGER NULL DEFAULT 0,
236
+ `keywordFinish` VARCHAR(100) NULL,
237
+ `delayMessage` INTEGER NULL,
238
+ `unknownMessage` VARCHAR(100) NULL,
239
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
240
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
241
+ `keepOpen` BOOLEAN NULL DEFAULT false,
242
+ `debounceTime` INTEGER NULL,
243
+ `ignoreJids` JSON NULL,
244
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
245
+ `updatedAt` TIMESTAMP NOT NULL,
246
+ `flowiseIdFallback` VARCHAR(100) NULL,
247
+ `instanceId` VARCHAR(191) NOT NULL,
248
+
249
+ UNIQUE INDEX `FlowiseSetting_instanceId_key`(`instanceId`),
250
+ PRIMARY KEY (`id`)
251
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
252
+
253
+ -- AddForeignKey
254
+ ALTER TABLE `GenericBot` ADD CONSTRAINT `GenericBot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
255
+
256
+ -- AddForeignKey
257
+ ALTER TABLE `GenericSetting` ADD CONSTRAINT `GenericSetting_botIdFallback_fkey` FOREIGN KEY (`botIdFallback`) REFERENCES `GenericBot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
258
+
259
+ -- AddForeignKey
260
+ ALTER TABLE `GenericSetting` ADD CONSTRAINT `GenericSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
261
+
262
+ -- AddForeignKey
263
+ ALTER TABLE `Flowise` ADD CONSTRAINT `Flowise_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
264
+
265
+ -- AddForeignKey
266
+ ALTER TABLE `FlowiseSetting` ADD CONSTRAINT `FlowiseSetting_flowiseIdFallback_fkey` FOREIGN KEY (`flowiseIdFallback`) REFERENCES `Flowise`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
267
+
268
+ -- AddForeignKey
269
+ ALTER TABLE `FlowiseSetting` ADD CONSTRAINT `FlowiseSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20240824162012_add_type_on_integration_sessions/migration.sql ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `createdAt` on the `GenericBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `updatedAt` on the `GenericBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `createdAt` on the `GenericSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `updatedAt` on the `GenericSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
52
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
53
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
54
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
55
+
56
+ */
57
+ -- AlterTable
58
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
59
+ MODIFY `updatedAt` TIMESTAMP NULL;
60
+
61
+ -- AlterTable
62
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
63
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
64
+
65
+ -- AlterTable
66
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
67
+ MODIFY `updatedAt` TIMESTAMP NULL;
68
+
69
+ -- AlterTable
70
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
71
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
72
+
73
+ -- AlterTable
74
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
75
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
76
+
77
+ -- AlterTable
78
+ ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
79
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
80
+
81
+ -- AlterTable
82
+ ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
83
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
84
+
85
+ -- AlterTable
86
+ ALTER TABLE `GenericBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
87
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
88
+
89
+ -- AlterTable
90
+ ALTER TABLE `GenericSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
91
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
92
+
93
+ -- AlterTable
94
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
95
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
96
+ MODIFY `updatedAt` TIMESTAMP NULL;
97
+
98
+ -- AlterTable
99
+ ALTER TABLE `IntegrationSession` ADD COLUMN `type` VARCHAR(100) NULL,
100
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
101
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
102
+
103
+ -- AlterTable
104
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
105
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
106
+
107
+ -- AlterTable
108
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
109
+
110
+ -- AlterTable
111
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
112
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
113
+
114
+ -- AlterTable
115
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
116
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
117
+
118
+ -- AlterTable
119
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
120
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
121
+
122
+ -- AlterTable
123
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
124
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
125
+
126
+ -- AlterTable
127
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
128
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
129
+
130
+ -- AlterTable
131
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
132
+
133
+ -- AlterTable
134
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
135
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
136
+
137
+ -- AlterTable
138
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
139
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
140
+
141
+ -- AlterTable
142
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
143
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
144
+
145
+ -- AlterTable
146
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
147
+ MODIFY `updatedAt` TIMESTAMP NULL;
148
+
149
+ -- AlterTable
150
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
151
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
152
+
153
+ -- AlterTable
154
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
155
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
156
+
157
+ -- AlterTable
158
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
159
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
prisma/mysql-migrations/20240825131301_change_to_evolution_bot/migration.sql ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+ - You are about to drop the `GenericBot` table. If the table is not empty, all the data it contains will be lost.
52
+ - You are about to drop the `GenericSetting` table. If the table is not empty, all the data it contains will be lost.
53
+
54
+ */
55
+ -- DropForeignKey
56
+ ALTER TABLE `GenericBot` DROP FOREIGN KEY `GenericBot_instanceId_fkey`;
57
+
58
+ -- DropForeignKey
59
+ ALTER TABLE `GenericSetting` DROP FOREIGN KEY `GenericSetting_botIdFallback_fkey`;
60
+
61
+ -- DropForeignKey
62
+ ALTER TABLE `GenericSetting` DROP FOREIGN KEY `GenericSetting_instanceId_fkey`;
63
+
64
+ -- AlterTable
65
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
66
+ MODIFY `updatedAt` TIMESTAMP NULL;
67
+
68
+ -- AlterTable
69
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
70
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
71
+
72
+ -- AlterTable
73
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
74
+ MODIFY `updatedAt` TIMESTAMP NULL;
75
+
76
+ -- AlterTable
77
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
78
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
79
+
80
+ -- AlterTable
81
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
82
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
83
+
84
+ -- AlterTable
85
+ ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
86
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
87
+
88
+ -- AlterTable
89
+ ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
90
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
91
+
92
+ -- AlterTable
93
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
94
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
95
+ MODIFY `updatedAt` TIMESTAMP NULL;
96
+
97
+ -- AlterTable
98
+ ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
99
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
100
+
101
+ -- AlterTable
102
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
103
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
104
+
105
+ -- AlterTable
106
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
107
+
108
+ -- AlterTable
109
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
110
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
111
+
112
+ -- AlterTable
113
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
114
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
115
+
116
+ -- AlterTable
117
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
118
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
119
+
120
+ -- AlterTable
121
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
122
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
123
+
124
+ -- AlterTable
125
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
126
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
127
+
128
+ -- AlterTable
129
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
130
+
131
+ -- AlterTable
132
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
133
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
134
+
135
+ -- AlterTable
136
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
137
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
138
+
139
+ -- AlterTable
140
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
141
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
142
+
143
+ -- AlterTable
144
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
145
+ MODIFY `updatedAt` TIMESTAMP NULL;
146
+
147
+ -- AlterTable
148
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
149
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
150
+
151
+ -- AlterTable
152
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
153
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
154
+
155
+ -- AlterTable
156
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
157
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
158
+
159
+ -- DropTable
160
+ DROP TABLE `GenericBot`;
161
+
162
+ -- DropTable
163
+ DROP TABLE `GenericSetting`;
164
+
165
+ -- CreateTable
166
+ CREATE TABLE `EvolutionBot` (
167
+ `id` VARCHAR(191) NOT NULL,
168
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
169
+ `description` VARCHAR(255) NULL,
170
+ `apiUrl` VARCHAR(255) NULL,
171
+ `apiKey` VARCHAR(255) NULL,
172
+ `expire` INTEGER NULL DEFAULT 0,
173
+ `keywordFinish` VARCHAR(100) NULL,
174
+ `delayMessage` INTEGER NULL,
175
+ `unknownMessage` VARCHAR(100) NULL,
176
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
177
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
178
+ `keepOpen` BOOLEAN NULL DEFAULT false,
179
+ `debounceTime` INTEGER NULL,
180
+ `ignoreJids` JSON NULL,
181
+ `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
182
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
183
+ `triggerValue` VARCHAR(191) NULL,
184
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
185
+ `updatedAt` TIMESTAMP NOT NULL,
186
+ `instanceId` VARCHAR(191) NOT NULL,
187
+
188
+ PRIMARY KEY (`id`)
189
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
190
+
191
+ -- CreateTable
192
+ CREATE TABLE `EvolutionBotSetting` (
193
+ `id` VARCHAR(191) NOT NULL,
194
+ `expire` INTEGER NULL DEFAULT 0,
195
+ `keywordFinish` VARCHAR(100) NULL,
196
+ `delayMessage` INTEGER NULL,
197
+ `unknownMessage` VARCHAR(100) NULL,
198
+ `listeningFromMe` BOOLEAN NULL DEFAULT false,
199
+ `stopBotFromMe` BOOLEAN NULL DEFAULT false,
200
+ `keepOpen` BOOLEAN NULL DEFAULT false,
201
+ `debounceTime` INTEGER NULL,
202
+ `ignoreJids` JSON NULL,
203
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
204
+ `updatedAt` TIMESTAMP NOT NULL,
205
+ `botIdFallback` VARCHAR(100) NULL,
206
+ `instanceId` VARCHAR(191) NOT NULL,
207
+
208
+ UNIQUE INDEX `EvolutionBotSetting_instanceId_key`(`instanceId`),
209
+ PRIMARY KEY (`id`)
210
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
211
+
212
+ -- AddForeignKey
213
+ ALTER TABLE `EvolutionBot` ADD CONSTRAINT `EvolutionBot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
214
+
215
+ -- AddForeignKey
216
+ ALTER TABLE `EvolutionBotSetting` ADD CONSTRAINT `EvolutionBotSetting_botIdFallback_fkey` FOREIGN KEY (`botIdFallback`) REFERENCES `EvolutionBot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
217
+
218
+ -- AddForeignKey
219
+ ALTER TABLE `EvolutionBotSetting` ADD CONSTRAINT `EvolutionBotSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20241001172800_add_message_status/migration.sql ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
52
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
53
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
54
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
55
+
56
+ */
57
+ -- AlterTable
58
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
59
+ MODIFY `updatedAt` TIMESTAMP NULL;
60
+
61
+ -- AlterTable
62
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
63
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
64
+
65
+ -- AlterTable
66
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
67
+ MODIFY `updatedAt` TIMESTAMP NULL;
68
+
69
+ -- AlterTable
70
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
71
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
72
+
73
+ -- AlterTable
74
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
75
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
76
+
77
+ -- AlterTable
78
+ ALTER TABLE `EvolutionBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
79
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
80
+
81
+ -- AlterTable
82
+ ALTER TABLE `EvolutionBotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
83
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
84
+
85
+ -- AlterTable
86
+ ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
87
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
88
+
89
+ -- AlterTable
90
+ ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
91
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
92
+
93
+ -- AlterTable
94
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
95
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
96
+ MODIFY `updatedAt` TIMESTAMP NULL;
97
+
98
+ -- AlterTable
99
+ ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
100
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
101
+
102
+ -- AlterTable
103
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
104
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
105
+
106
+ -- AlterTable
107
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
108
+
109
+ -- AlterTable
110
+ ALTER TABLE `Message` ADD COLUMN `status` INTEGER NULL;
111
+
112
+ -- AlterTable
113
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
114
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
115
+
116
+ -- AlterTable
117
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
118
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
119
+
120
+ -- AlterTable
121
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
122
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
123
+
124
+ -- AlterTable
125
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
126
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
127
+
128
+ -- AlterTable
129
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
130
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
131
+
132
+ -- AlterTable
133
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
134
+
135
+ -- AlterTable
136
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
137
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
138
+
139
+ -- AlterTable
140
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
141
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
142
+
143
+ -- AlterTable
144
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
145
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
146
+
147
+ -- AlterTable
148
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
149
+ MODIFY `updatedAt` TIMESTAMP NULL;
150
+
151
+ -- AlterTable
152
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
153
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
154
+
155
+ -- AlterTable
156
+ ALTER TABLE `Webhook` ADD COLUMN `headers` JSON NULL,
157
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
158
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
159
+
160
+ -- AlterTable
161
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
162
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
163
+
164
+ -- CreateTable
165
+ CREATE TABLE `IsOnWhatsapp` (
166
+ `id` VARCHAR(191) NOT NULL,
167
+ `remoteJid` VARCHAR(100) NOT NULL,
168
+ `jidOptions` VARCHAR(191) NOT NULL,
169
+ `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
170
+ `updatedAt` TIMESTAMP NOT NULL,
171
+
172
+ UNIQUE INDEX `IsOnWhatsapp_remoteJid_key`(`remoteJid`),
173
+ PRIMARY KEY (`id`)
174
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
prisma/mysql-migrations/20241108101333_fix_message_status_as_string/migration.sql ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
52
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
53
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
54
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
55
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
56
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
57
+
58
+ */
59
+ -- AlterTable
60
+ ALTER TABLE `Chat` ADD COLUMN `unreadMessages` INTEGER NOT NULL DEFAULT 0,
61
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
62
+ MODIFY `updatedAt` TIMESTAMP NULL;
63
+
64
+ -- AlterTable
65
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
66
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
67
+
68
+ -- AlterTable
69
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
70
+ MODIFY `updatedAt` TIMESTAMP NULL;
71
+
72
+ -- AlterTable
73
+ ALTER TABLE `Dify` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
74
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
75
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
76
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
77
+
78
+ -- AlterTable
79
+ ALTER TABLE `DifySetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
80
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
81
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
82
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
83
+
84
+ -- AlterTable
85
+ ALTER TABLE `EvolutionBot` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
86
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
87
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
88
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
89
+
90
+ -- AlterTable
91
+ ALTER TABLE `EvolutionBotSetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
92
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
93
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
94
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
95
+
96
+ -- AlterTable
97
+ ALTER TABLE `Flowise` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
98
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
99
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
100
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
101
+
102
+ -- AlterTable
103
+ ALTER TABLE `FlowiseSetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
104
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
105
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
106
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
107
+
108
+ -- AlterTable
109
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
110
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
111
+ MODIFY `updatedAt` TIMESTAMP NULL;
112
+
113
+ -- AlterTable
114
+ ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
115
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
116
+
117
+ -- AlterTable
118
+ ALTER TABLE `IsOnWhatsapp` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
119
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
120
+
121
+ -- AlterTable
122
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
123
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
124
+
125
+ -- AlterTable
126
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
127
+
128
+ -- AlterTable
129
+ ALTER TABLE `Message` MODIFY `status` VARCHAR(30) NULL;
130
+
131
+ -- AlterTable
132
+ ALTER TABLE `OpenaiBot` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
133
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
134
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
135
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
136
+
137
+ -- AlterTable
138
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
139
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
140
+
141
+ -- AlterTable
142
+ ALTER TABLE `OpenaiSetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
143
+ ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
144
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
145
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
146
+
147
+ -- AlterTable
148
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
149
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
150
+
151
+ -- AlterTable
152
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
153
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
154
+
155
+ -- AlterTable
156
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
157
+
158
+ -- AlterTable
159
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
160
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
161
+
162
+ -- AlterTable
163
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
164
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
165
+
166
+ -- AlterTable
167
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
168
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
169
+
170
+ -- AlterTable
171
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
172
+ MODIFY `updatedAt` TIMESTAMP NULL;
173
+
174
+ -- AlterTable
175
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
176
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
177
+
178
+ -- AlterTable
179
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
180
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
181
+
182
+ -- AlterTable
183
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
184
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
185
+
186
+ -- CreateTable
187
+ CREATE TABLE `Pusher` (
188
+ `id` VARCHAR(191) NOT NULL,
189
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
190
+ `appId` VARCHAR(100) NOT NULL,
191
+ `key` VARCHAR(100) NOT NULL,
192
+ `secret` VARCHAR(100) NOT NULL,
193
+ `cluster` VARCHAR(100) NOT NULL,
194
+ `useTLS` BOOLEAN NOT NULL DEFAULT false,
195
+ `events` JSON NOT NULL,
196
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
197
+ `updatedAt` TIMESTAMP NOT NULL,
198
+ `instanceId` VARCHAR(191) NOT NULL,
199
+
200
+ UNIQUE INDEX `Pusher_instanceId_key`(`instanceId`),
201
+ PRIMARY KEY (`id`)
202
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
203
+
204
+ -- CreateIndex
205
+ CREATE INDEX `Chat_remoteJid_idx` ON `Chat`(`remoteJid`);
206
+
207
+ -- CreateIndex
208
+ CREATE INDEX `Contact_remoteJid_idx` ON `Contact`(`remoteJid`);
209
+
210
+ -- CreateIndex
211
+ CREATE INDEX `Setting_instanceId_idx` ON `Setting`(`instanceId`);
212
+
213
+ -- CreateIndex
214
+ CREATE INDEX `Webhook_instanceId_idx` ON `Webhook`(`instanceId`);
215
+
216
+ -- AddForeignKey
217
+ ALTER TABLE `Pusher` ADD CONSTRAINT `Pusher_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
218
+
219
+ -- RenameIndex
220
+ ALTER TABLE `Chat` RENAME INDEX `Chat_instanceId_fkey` TO `Chat_instanceId_idx`;
221
+
222
+ -- RenameIndex
223
+ ALTER TABLE `Contact` RENAME INDEX `Contact_instanceId_fkey` TO `Contact_instanceId_idx`;
224
+
225
+ -- RenameIndex
226
+ ALTER TABLE `Message` RENAME INDEX `Message_instanceId_fkey` TO `Message_instanceId_idx`;
227
+
228
+ -- RenameIndex
229
+ ALTER TABLE `MessageUpdate` RENAME INDEX `MessageUpdate_instanceId_fkey` TO `MessageUpdate_instanceId_idx`;
230
+
231
+ -- RenameIndex
232
+ ALTER TABLE `MessageUpdate` RENAME INDEX `MessageUpdate_messageId_fkey` TO `MessageUpdate_messageId_idx`;
prisma/mysql-migrations/20250214181954_add_wavoip_token_column/migration.sql ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
32
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `createdAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `updatedAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
52
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
53
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
54
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
55
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
56
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
57
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
58
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
59
+ - A unique constraint covering the columns `[instanceId,remoteJid]` on the table `Chat` will be added. If there are existing duplicate values, this will fail.
60
+
61
+ */
62
+ -- AlterTable
63
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
64
+ MODIFY `updatedAt` TIMESTAMP NULL;
65
+
66
+ -- AlterTable
67
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
68
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
69
+
70
+ -- AlterTable
71
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
72
+ MODIFY `updatedAt` TIMESTAMP NULL;
73
+
74
+ -- AlterTable
75
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
76
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
77
+
78
+ -- AlterTable
79
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
80
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
81
+
82
+ -- AlterTable
83
+ ALTER TABLE `EvolutionBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
84
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
85
+
86
+ -- AlterTable
87
+ ALTER TABLE `EvolutionBotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
88
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
89
+
90
+ -- AlterTable
91
+ ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
92
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
93
+
94
+ -- AlterTable
95
+ ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
96
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
97
+
98
+ -- AlterTable
99
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
100
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
101
+ MODIFY `updatedAt` TIMESTAMP NULL;
102
+
103
+ -- AlterTable
104
+ ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
105
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
106
+
107
+ -- AlterTable
108
+ ALTER TABLE `IsOnWhatsapp` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
109
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
110
+
111
+ -- AlterTable
112
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
113
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
114
+
115
+ -- AlterTable
116
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
117
+
118
+ -- AlterTable
119
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
120
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
121
+
122
+ -- AlterTable
123
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
124
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
125
+
126
+ -- AlterTable
127
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
128
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
129
+
130
+ -- AlterTable
131
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
132
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
133
+
134
+ -- AlterTable
135
+ ALTER TABLE `Pusher` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
136
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
137
+
138
+ -- AlterTable
139
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
140
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
141
+
142
+ -- AlterTable
143
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
144
+
145
+ -- AlterTable
146
+ ALTER TABLE `Setting` ADD COLUMN `wavoipToken` VARCHAR(100) NULL,
147
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
148
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
149
+
150
+ -- AlterTable
151
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
152
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
153
+
154
+ -- AlterTable
155
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
156
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
157
+
158
+ -- AlterTable
159
+ ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
160
+ MODIFY `updatedAt` TIMESTAMP NULL;
161
+
162
+ -- AlterTable
163
+ ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
164
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
165
+
166
+ -- AlterTable
167
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
168
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
169
+
170
+ -- AlterTable
171
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
172
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
173
+
174
+ -- CreateIndex
175
+ CREATE UNIQUE INDEX `Chat_instanceId_remoteJid_key` ON `Chat`(`instanceId`, `remoteJid`);
prisma/mysql-migrations/20250225180031_add_nats_integration/migration.sql ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE `Nats` (
3
+ `id` VARCHAR(191) NOT NULL,
4
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
5
+ `events` JSON NOT NULL,
6
+ `createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
7
+ `updatedAt` TIMESTAMP NOT NULL,
8
+ `instanceId` VARCHAR(191) NOT NULL,
9
+
10
+ PRIMARY KEY (`id`)
11
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
12
+
13
+ -- CreateIndex
14
+ CREATE UNIQUE INDEX `Nats_instanceId_key` ON `Nats`(`instanceId`);
15
+
16
+ -- AddForeignKey
17
+ ALTER TABLE `Nats` ADD CONSTRAINT `Nats_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20250510035200_add_wavoip_token_to_settings_table/migration.sql ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Chat` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+
8
+ -- AlterTable
9
+ SET @column_exists := (
10
+ SELECT COUNT(*)
11
+ FROM information_schema.columns
12
+ WHERE table_schema = DATABASE()
13
+ AND table_name = 'Setting'
14
+ AND column_name = 'wavoipToken'
15
+ );
16
+
17
+ SET @sql := IF(@column_exists = 0,
18
+ 'ALTER TABLE Setting ADD COLUMN wavoipToken VARCHAR(100);',
19
+ 'SELECT "Column already exists";'
20
+ );
21
+
22
+ PREPARE stmt FROM @sql;
23
+ EXECUTE stmt;
24
+ DEALLOCATE PREPARE stmt;
25
+
26
+ ALTER TABLE Chat ADD CONSTRAINT unique_remote_instance UNIQUE (remoteJid, instanceId);
prisma/mysql-migrations/20250514232744_add_n8n_table/migration.sql ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE `N8n` (
3
+ `id` VARCHAR(191) NOT NULL,
4
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
5
+ `description` VARCHAR(255),
6
+ `webhookUrl` VARCHAR(255),
7
+ `basicAuthUser` VARCHAR(255),
8
+ `basicAuthPass` VARCHAR(255),
9
+ `expire` INTEGER DEFAULT 0,
10
+ `keywordFinish` VARCHAR(100),
11
+ `delayMessage` INTEGER,
12
+ `unknownMessage` VARCHAR(100),
13
+ `listeningFromMe` BOOLEAN DEFAULT false,
14
+ `stopBotFromMe` BOOLEAN DEFAULT false,
15
+ `keepOpen` BOOLEAN DEFAULT false,
16
+ `debounceTime` INTEGER,
17
+ `ignoreJids` JSON,
18
+ `splitMessages` BOOLEAN DEFAULT false,
19
+ `timePerChar` INTEGER DEFAULT 50,
20
+ `triggerType` ENUM('all', 'keyword', 'none') NULL,
21
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
22
+ `triggerValue` VARCHAR(191) NULL,
23
+ `createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
24
+ `updatedAt` TIMESTAMP NOT NULL,
25
+ `instanceId` VARCHAR(191) NOT NULL,
26
+
27
+ PRIMARY KEY (`id`)
28
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
29
+
30
+ -- CreateTable
31
+ CREATE TABLE `N8nSetting` (
32
+ `id` VARCHAR(191) NOT NULL,
33
+ `expire` INTEGER DEFAULT 0,
34
+ `keywordFinish` VARCHAR(100),
35
+ `delayMessage` INTEGER,
36
+ `unknownMessage` VARCHAR(100),
37
+ `listeningFromMe` BOOLEAN DEFAULT false,
38
+ `stopBotFromMe` BOOLEAN DEFAULT false,
39
+ `keepOpen` BOOLEAN DEFAULT false,
40
+ `debounceTime` INTEGER,
41
+ `ignoreJids` JSON,
42
+ `splitMessages` BOOLEAN DEFAULT false,
43
+ `timePerChar` INTEGER DEFAULT 50,
44
+ `createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
45
+ `updatedAt` TIMESTAMP NOT NULL,
46
+ `n8nIdFallback` VARCHAR(100),
47
+ `instanceId` VARCHAR(191) NOT NULL,
48
+
49
+ PRIMARY KEY (`id`)
50
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
51
+
52
+ -- CreateIndex
53
+ CREATE UNIQUE INDEX `N8nSetting_instanceId_key` ON `N8nSetting`(`instanceId`);
54
+
55
+ -- AddForeignKey
56
+ ALTER TABLE `N8n` ADD CONSTRAINT `N8n_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
57
+
58
+ -- AddForeignKey
59
+ ALTER TABLE `N8nSetting` ADD CONSTRAINT `N8nSetting_n8nIdFallback_fkey` FOREIGN KEY (`n8nIdFallback`) REFERENCES `N8n`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
60
+
61
+ -- AddForeignKey
62
+ ALTER TABLE `N8nSetting` ADD CONSTRAINT `N8nSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20250515211815_add_evoai_table/migration.sql ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE `Evoai` (
3
+ `id` VARCHAR(191) NOT NULL,
4
+ `enabled` BOOLEAN NOT NULL DEFAULT true,
5
+ `description` VARCHAR(255),
6
+ `agentUrl` VARCHAR(255),
7
+ `apiKey` VARCHAR(255),
8
+ `expire` INTEGER DEFAULT 0,
9
+ `keywordFinish` VARCHAR(100),
10
+ `delayMessage` INTEGER,
11
+ `unknownMessage` VARCHAR(100),
12
+ `listeningFromMe` BOOLEAN DEFAULT false,
13
+ `stopBotFromMe` BOOLEAN DEFAULT false,
14
+ `keepOpen` BOOLEAN DEFAULT false,
15
+ `debounceTime` INTEGER,
16
+ `ignoreJids` JSON,
17
+ `splitMessages` BOOLEAN DEFAULT false,
18
+ `timePerChar` INTEGER DEFAULT 50,
19
+ `triggerType` ENUM('all', 'keyword', 'none') NULL,
20
+ `triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
21
+ `triggerValue` VARCHAR(191) NULL,
22
+ `createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
23
+ `updatedAt` TIMESTAMP NOT NULL,
24
+ `instanceId` VARCHAR(191) NOT NULL,
25
+
26
+ PRIMARY KEY (`id`)
27
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
28
+
29
+ -- CreateTable
30
+ CREATE TABLE `EvoaiSetting` (
31
+ `id` VARCHAR(191) NOT NULL,
32
+ `expire` INTEGER DEFAULT 0,
33
+ `keywordFinish` VARCHAR(100),
34
+ `delayMessage` INTEGER,
35
+ `unknownMessage` VARCHAR(100),
36
+ `listeningFromMe` BOOLEAN DEFAULT false,
37
+ `stopBotFromMe` BOOLEAN DEFAULT false,
38
+ `keepOpen` BOOLEAN DEFAULT false,
39
+ `debounceTime` INTEGER,
40
+ `ignoreJids` JSON,
41
+ `splitMessages` BOOLEAN DEFAULT false,
42
+ `timePerChar` INTEGER DEFAULT 50,
43
+ `createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
44
+ `updatedAt` TIMESTAMP NOT NULL,
45
+ `evoaiIdFallback` VARCHAR(100),
46
+ `instanceId` VARCHAR(191) NOT NULL,
47
+
48
+ PRIMARY KEY (`id`)
49
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
50
+
51
+ -- CreateIndex
52
+ CREATE UNIQUE INDEX `EvoaiSetting_instanceId_key` ON `EvoaiSetting`(`instanceId`);
53
+
54
+ -- AddForeignKey
55
+ ALTER TABLE `Evoai` ADD CONSTRAINT `Evoai_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
56
+
57
+ -- AddForeignKey
58
+ ALTER TABLE `EvoaiSetting` ADD CONSTRAINT `EvoaiSetting_evoaiIdFallback_fkey` FOREIGN KEY (`evoaiIdFallback`) REFERENCES `Evoai`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
59
+
60
+ -- AddForeignKey
61
+ ALTER TABLE `EvoaiSetting` ADD CONSTRAINT `EvoaiSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/20250516012152_remove_unique_atribute_for_file_name_in_media/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- DropIndex
2
+ ALTER TABLE `Media` DROP INDEX `Media_fileName_key`;
prisma/mysql-migrations/20250612155048_add_coluns_trypebot_tables/migration.sql ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE `Typebot` ADD COLUMN `splitMessages` BOOLEAN DEFAULT false,
3
+ ADD COLUMN `timePerChar` INTEGER DEFAULT 50;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE `TypebotSetting` ADD COLUMN `splitMessages` BOOLEAN DEFAULT false,
7
+ ADD COLUMN `timePerChar` INTEGER DEFAULT 50;
prisma/mysql-migrations/20250613143000_add_lid_column_to_is_onwhatsapp/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE `IsOnWhatsapp` ADD COLUMN `lid` VARCHAR(100);
prisma/mysql-migrations/20250918183910_add_kafka_integration/migration.sql ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
5
+ - You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
6
+ - You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
7
+ - You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
8
+ - You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
9
+ - You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
10
+ - You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
11
+ - You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
12
+ - You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
13
+ - You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
14
+ - You are about to alter the column `createdAt` on the `Evoai` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
15
+ - You are about to alter the column `updatedAt` on the `Evoai` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
16
+ - You are about to alter the column `createdAt` on the `EvoaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
17
+ - You are about to alter the column `updatedAt` on the `EvoaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
18
+ - You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
19
+ - You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
20
+ - You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
21
+ - You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
22
+ - You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
23
+ - You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
24
+ - You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
25
+ - You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
26
+ - You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
27
+ - You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
28
+ - You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
29
+ - You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
30
+ - You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
31
+ - You are about to drop the column `lid` on the `IsOnWhatsapp` table. All the data in the column will be lost.
32
+ - You are about to alter the column `createdAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
33
+ - You are about to alter the column `updatedAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
34
+ - You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
35
+ - You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
36
+ - You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
37
+ - You are about to alter the column `createdAt` on the `N8n` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
38
+ - You are about to alter the column `updatedAt` on the `N8n` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
39
+ - You are about to alter the column `createdAt` on the `N8nSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
40
+ - You are about to alter the column `updatedAt` on the `N8nSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
41
+ - You are about to alter the column `createdAt` on the `Nats` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
42
+ - You are about to alter the column `updatedAt` on the `Nats` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
43
+ - You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
44
+ - You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
45
+ - You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
46
+ - You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
47
+ - You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
48
+ - You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
49
+ - You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
50
+ - You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
51
+ - You are about to alter the column `createdAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
52
+ - You are about to alter the column `updatedAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
53
+ - You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
54
+ - You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
55
+ - You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
56
+ - You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
57
+ - You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
58
+ - You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
59
+ - You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
60
+ - You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
61
+ - You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
62
+ - You are about to drop the column `splitMessages` on the `Typebot` table. All the data in the column will be lost.
63
+ - You are about to drop the column `timePerChar` on the `Typebot` table. All the data in the column will be lost.
64
+ - You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
65
+ - You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
66
+ - You are about to drop the column `splitMessages` on the `TypebotSetting` table. All the data in the column will be lost.
67
+ - You are about to drop the column `timePerChar` on the `TypebotSetting` table. All the data in the column will be lost.
68
+ - You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
69
+ - You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
70
+ - You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
71
+ - You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
72
+ - You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
73
+ - You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
74
+
75
+ */
76
+ -- DropIndex
77
+ DROP INDEX `unique_remote_instance` ON `Chat`;
78
+
79
+ -- AlterTable
80
+ ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
81
+ MODIFY `updatedAt` TIMESTAMP NULL;
82
+
83
+ -- AlterTable
84
+ ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
85
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
86
+
87
+ -- AlterTable
88
+ ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
89
+ MODIFY `updatedAt` TIMESTAMP NULL;
90
+
91
+ -- AlterTable
92
+ ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
93
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
94
+
95
+ -- AlterTable
96
+ ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
97
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
98
+
99
+ -- AlterTable
100
+ ALTER TABLE `Evoai` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
101
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
102
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
103
+
104
+ -- AlterTable
105
+ ALTER TABLE `EvoaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
106
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
107
+
108
+ -- AlterTable
109
+ ALTER TABLE `EvolutionBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
110
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
111
+
112
+ -- AlterTable
113
+ ALTER TABLE `EvolutionBotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
114
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
115
+
116
+ -- AlterTable
117
+ ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
118
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
119
+
120
+ -- AlterTable
121
+ ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
122
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
123
+
124
+ -- AlterTable
125
+ ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
126
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
127
+ MODIFY `updatedAt` TIMESTAMP NULL;
128
+
129
+ -- AlterTable
130
+ ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
131
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
132
+
133
+ -- AlterTable
134
+ ALTER TABLE `IsOnWhatsapp` DROP COLUMN `lid`,
135
+ MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
136
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
137
+
138
+ -- AlterTable
139
+ ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
140
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
141
+
142
+ -- AlterTable
143
+ ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
144
+
145
+ -- AlterTable
146
+ ALTER TABLE `N8n` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
147
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
148
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
149
+
150
+ -- AlterTable
151
+ ALTER TABLE `N8nSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
152
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
153
+
154
+ -- AlterTable
155
+ ALTER TABLE `Nats` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
156
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
157
+
158
+ -- AlterTable
159
+ ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
160
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
161
+
162
+ -- AlterTable
163
+ ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
164
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
165
+
166
+ -- AlterTable
167
+ ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
168
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
169
+
170
+ -- AlterTable
171
+ ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
172
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
173
+
174
+ -- AlterTable
175
+ ALTER TABLE `Pusher` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
176
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
177
+
178
+ -- AlterTable
179
+ ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
180
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
181
+
182
+ -- AlterTable
183
+ ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
184
+
185
+ -- AlterTable
186
+ ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
187
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
188
+
189
+ -- AlterTable
190
+ ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
191
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
192
+
193
+ -- AlterTable
194
+ ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
195
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
196
+
197
+ -- AlterTable
198
+ ALTER TABLE `Typebot` DROP COLUMN `splitMessages`,
199
+ DROP COLUMN `timePerChar`,
200
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
201
+ MODIFY `updatedAt` TIMESTAMP NULL;
202
+
203
+ -- AlterTable
204
+ ALTER TABLE `TypebotSetting` DROP COLUMN `splitMessages`,
205
+ DROP COLUMN `timePerChar`,
206
+ MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
207
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
208
+
209
+ -- AlterTable
210
+ ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
211
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
212
+
213
+ -- AlterTable
214
+ ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
215
+ MODIFY `updatedAt` TIMESTAMP NOT NULL;
216
+
217
+ -- CreateTable
218
+ CREATE TABLE `Kafka` (
219
+ `id` VARCHAR(191) NOT NULL,
220
+ `enabled` BOOLEAN NOT NULL DEFAULT false,
221
+ `events` JSON NOT NULL,
222
+ `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
223
+ `updatedAt` TIMESTAMP NOT NULL,
224
+ `instanceId` VARCHAR(191) NOT NULL,
225
+
226
+ UNIQUE INDEX `Kafka_instanceId_key`(`instanceId`),
227
+ PRIMARY KEY (`id`)
228
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
229
+
230
+ -- AddForeignKey
231
+ ALTER TABLE `Kafka` ADD CONSTRAINT `Kafka_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
prisma/mysql-migrations/migration_lock.toml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "mysql"
prisma/mysql-schema.prisma ADDED
@@ -0,0 +1,757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This is your Prisma schema file,
2
+ // learn more about it in the docs: https://pris.ly/d/prisma-schema
3
+
4
+ // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5
+ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6
+
7
+ generator client {
8
+ provider = "prisma-client-js"
9
+ }
10
+
11
+ datasource db {
12
+ provider = "mysql"
13
+ url = env("DATABASE_CONNECTION_URI")
14
+ }
15
+
16
+ enum InstanceConnectionStatus {
17
+ open
18
+ close
19
+ connecting
20
+ }
21
+
22
+ enum DeviceMessage {
23
+ ios
24
+ android
25
+ web
26
+ unknown
27
+ desktop
28
+ }
29
+
30
+ enum SessionStatus {
31
+ opened
32
+ closed
33
+ paused
34
+ }
35
+
36
+ enum TriggerType {
37
+ all
38
+ keyword
39
+ none
40
+ advanced
41
+ }
42
+
43
+ enum TriggerOperator {
44
+ contains
45
+ equals
46
+ startsWith
47
+ endsWith
48
+ regex
49
+ }
50
+
51
+ enum OpenaiBotType {
52
+ assistant
53
+ chatCompletion
54
+ }
55
+
56
+ enum DifyBotType {
57
+ chatBot
58
+ textGenerator
59
+ agent
60
+ workflow
61
+ }
62
+
63
+ model Instance {
64
+ id String @id @default(cuid())
65
+ name String @unique @db.VarChar(255)
66
+ connectionStatus InstanceConnectionStatus @default(open)
67
+ ownerJid String? @db.VarChar(100)
68
+ profileName String? @db.VarChar(100)
69
+ profilePicUrl String? @db.VarChar(500)
70
+ integration String? @db.VarChar(100)
71
+ number String? @db.VarChar(100)
72
+ businessId String? @db.VarChar(100)
73
+ token String? @db.VarChar(255)
74
+ clientName String? @db.VarChar(100)
75
+ disconnectionReasonCode Int? @db.Int
76
+ disconnectionObject Json? @db.Json
77
+ disconnectionAt DateTime? @db.Timestamp
78
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
79
+ updatedAt DateTime? @updatedAt @db.Timestamp
80
+ Chat Chat[]
81
+ Contact Contact[]
82
+ Message Message[]
83
+ Webhook Webhook?
84
+ Chatwoot Chatwoot?
85
+ Label Label[]
86
+ Proxy Proxy?
87
+ Setting Setting?
88
+ Rabbitmq Rabbitmq?
89
+ Nats Nats?
90
+ Sqs Sqs?
91
+ Kafka Kafka?
92
+ Websocket Websocket?
93
+ Typebot Typebot[]
94
+ Session Session?
95
+ MessageUpdate MessageUpdate[]
96
+ TypebotSetting TypebotSetting?
97
+ Media Media[]
98
+ OpenaiCreds OpenaiCreds[]
99
+ OpenaiBot OpenaiBot[]
100
+ OpenaiSetting OpenaiSetting?
101
+ Template Template[]
102
+ Dify Dify[]
103
+ DifySetting DifySetting?
104
+ IntegrationSession IntegrationSession[]
105
+ EvolutionBot EvolutionBot[]
106
+ EvolutionBotSetting EvolutionBotSetting?
107
+ Flowise Flowise[]
108
+ FlowiseSetting FlowiseSetting?
109
+ N8n N8n[]
110
+ N8nSetting N8nSetting?
111
+ Evoai Evoai[]
112
+ EvoaiSetting EvoaiSetting?
113
+ Pusher Pusher?
114
+ }
115
+
116
+ model Session {
117
+ id String @id @default(cuid())
118
+ sessionId String @unique
119
+ creds String? @db.Text
120
+ createdAt DateTime @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
121
+ Instance Instance @relation(fields: [sessionId], references: [id], onDelete: Cascade)
122
+ }
123
+
124
+ model Chat {
125
+ id String @id @default(cuid())
126
+ remoteJid String @db.VarChar(100)
127
+ name String? @db.VarChar(100)
128
+ labels Json? @db.Json
129
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
130
+ updatedAt DateTime? @updatedAt @db.Timestamp
131
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
132
+ instanceId String
133
+ unreadMessages Int @default(0)
134
+
135
+ @@unique([instanceId, remoteJid])
136
+ @@index([instanceId])
137
+ @@index([remoteJid])
138
+ }
139
+
140
+ model Contact {
141
+ id String @id @default(cuid())
142
+ remoteJid String @db.VarChar(100)
143
+ pushName String? @db.VarChar(100)
144
+ profilePicUrl String? @db.VarChar(500)
145
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
146
+ updatedAt DateTime? @updatedAt @db.Timestamp
147
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
148
+ instanceId String
149
+
150
+ @@unique([remoteJid, instanceId])
151
+ @@index([remoteJid])
152
+ @@index([instanceId])
153
+ }
154
+
155
+ model Message {
156
+ id String @id @default(cuid())
157
+ key Json @db.Json
158
+ pushName String? @db.VarChar(100)
159
+ participant String? @db.VarChar(100)
160
+ messageType String @db.VarChar(100)
161
+ message Json @db.Json
162
+ contextInfo Json? @db.Json
163
+ source DeviceMessage
164
+ messageTimestamp Int @db.Int
165
+ chatwootMessageId Int? @db.Int
166
+ chatwootInboxId Int? @db.Int
167
+ chatwootConversationId Int? @db.Int
168
+ chatwootContactInboxSourceId String? @db.VarChar(100)
169
+ chatwootIsRead Boolean? @default(false)
170
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
171
+ instanceId String
172
+ typebotSessionId String?
173
+ MessageUpdate MessageUpdate[]
174
+ Media Media?
175
+ webhookUrl String? @db.VarChar(500)
176
+ status String? @db.VarChar(30)
177
+
178
+ sessionId String?
179
+ session IntegrationSession? @relation(fields: [sessionId], references: [id])
180
+
181
+ @@index([instanceId])
182
+ }
183
+
184
+ model MessageUpdate {
185
+ id String @id @default(cuid())
186
+ keyId String @db.VarChar(100)
187
+ remoteJid String @db.VarChar(100)
188
+ fromMe Boolean
189
+ participant String? @db.VarChar(100)
190
+ pollUpdates Json? @db.Json
191
+ status String @db.VarChar(30)
192
+ Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
193
+ messageId String
194
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
195
+ instanceId String
196
+
197
+ @@index([instanceId])
198
+ @@index([messageId])
199
+ }
200
+
201
+ model Webhook {
202
+ id String @id @default(cuid())
203
+ url String @db.VarChar(500)
204
+ headers Json? @db.Json
205
+ enabled Boolean? @default(true)
206
+ events Json? @db.Json
207
+ webhookByEvents Boolean? @default(false)
208
+ webhookBase64 Boolean? @default(false)
209
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
210
+ updatedAt DateTime @updatedAt @db.Timestamp
211
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
212
+ instanceId String @unique
213
+
214
+ @@index([instanceId])
215
+ }
216
+
217
+ model Chatwoot {
218
+ id String @id @default(cuid())
219
+ enabled Boolean? @default(true)
220
+ accountId String? @db.VarChar(100)
221
+ token String? @db.VarChar(100)
222
+ url String? @db.VarChar(500)
223
+ nameInbox String? @db.VarChar(100)
224
+ signMsg Boolean? @default(false)
225
+ signDelimiter String? @db.VarChar(100)
226
+ number String? @db.VarChar(100)
227
+ reopenConversation Boolean? @default(false)
228
+ conversationPending Boolean? @default(false)
229
+ mergeBrazilContacts Boolean? @default(false)
230
+ importContacts Boolean? @default(false)
231
+ importMessages Boolean? @default(false)
232
+ daysLimitImportMessages Int? @db.Int
233
+ organization String? @db.VarChar(100)
234
+ logo String? @db.VarChar(500)
235
+ ignoreJids Json?
236
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
237
+ updatedAt DateTime @updatedAt @db.Timestamp
238
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
239
+ instanceId String @unique
240
+ }
241
+
242
+ model Label {
243
+ id String @id @default(cuid())
244
+ labelId String? @db.VarChar(100)
245
+ name String @db.VarChar(100)
246
+ color String @db.VarChar(100)
247
+ predefinedId String? @db.VarChar(100)
248
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
249
+ updatedAt DateTime @updatedAt @db.Timestamp
250
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
251
+ instanceId String
252
+ }
253
+
254
+ model Proxy {
255
+ id String @id @default(cuid())
256
+ enabled Boolean @default(false)
257
+ host String @db.VarChar(100)
258
+ port String @db.VarChar(100)
259
+ protocol String @db.VarChar(100)
260
+ username String @db.VarChar(100)
261
+ password String @db.VarChar(100)
262
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
263
+ updatedAt DateTime @updatedAt @db.Timestamp
264
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
265
+ instanceId String @unique
266
+ }
267
+
268
+ model Setting {
269
+ id String @id @default(cuid())
270
+ rejectCall Boolean @default(false)
271
+ msgCall String? @db.VarChar(100)
272
+ groupsIgnore Boolean @default(false)
273
+ alwaysOnline Boolean @default(false)
274
+ readMessages Boolean @default(false)
275
+ readStatus Boolean @default(false)
276
+ syncFullHistory Boolean @default(false)
277
+ wavoipToken String? @db.VarChar(100)
278
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
279
+ updatedAt DateTime @updatedAt @db.Timestamp
280
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
281
+ instanceId String @unique
282
+
283
+ @@index([instanceId])
284
+ }
285
+
286
+ model Rabbitmq {
287
+ id String @id @default(cuid())
288
+ enabled Boolean @default(false)
289
+ events Json @db.Json
290
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
291
+ updatedAt DateTime @updatedAt @db.Timestamp
292
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
293
+ instanceId String @unique
294
+ }
295
+
296
+ model Nats {
297
+ id String @id @default(cuid())
298
+ enabled Boolean @default(false)
299
+ events Json @db.Json
300
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
301
+ updatedAt DateTime @updatedAt @db.Timestamp
302
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
303
+ instanceId String @unique
304
+ }
305
+
306
+ model Sqs {
307
+ id String @id @default(cuid())
308
+ enabled Boolean @default(false)
309
+ events Json @db.Json
310
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
311
+ updatedAt DateTime @updatedAt @db.Timestamp
312
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
313
+ instanceId String @unique
314
+ }
315
+
316
+ model Kafka {
317
+ id String @id @default(cuid())
318
+ enabled Boolean @default(false)
319
+ events Json @db.Json
320
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
321
+ updatedAt DateTime @updatedAt @db.Timestamp
322
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
323
+ instanceId String @unique
324
+ }
325
+
326
+ model Websocket {
327
+ id String @id @default(cuid())
328
+ enabled Boolean @default(false)
329
+ events Json @db.Json
330
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
331
+ updatedAt DateTime @updatedAt @db.Timestamp
332
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
333
+ instanceId String @unique
334
+ }
335
+
336
+ model Pusher {
337
+ id String @id @default(cuid())
338
+ enabled Boolean @default(false)
339
+ appId String @db.VarChar(100)
340
+ key String @db.VarChar(100)
341
+ secret String @db.VarChar(100)
342
+ cluster String @db.VarChar(100)
343
+ useTLS Boolean @default(false)
344
+ events Json @db.Json
345
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
346
+ updatedAt DateTime @updatedAt @db.Timestamp
347
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
348
+ instanceId String @unique
349
+ }
350
+
351
+ model Typebot {
352
+ id String @id @default(cuid())
353
+ enabled Boolean @default(true)
354
+ description String? @db.VarChar(255)
355
+ url String @db.VarChar(500)
356
+ typebot String @db.VarChar(100)
357
+ expire Int? @default(0) @db.Int
358
+ keywordFinish String? @db.VarChar(100)
359
+ delayMessage Int? @db.Int
360
+ unknownMessage String? @db.VarChar(100)
361
+ listeningFromMe Boolean? @default(false)
362
+ stopBotFromMe Boolean? @default(false)
363
+ keepOpen Boolean? @default(false)
364
+ debounceTime Int? @db.Int
365
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
366
+ updatedAt DateTime? @updatedAt @db.Timestamp
367
+ ignoreJids Json?
368
+ triggerType TriggerType?
369
+ triggerOperator TriggerOperator?
370
+ triggerValue String?
371
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
372
+ instanceId String
373
+ TypebotSetting TypebotSetting[]
374
+ }
375
+
376
+ model TypebotSetting {
377
+ id String @id @default(cuid())
378
+ expire Int? @default(0) @db.Int
379
+ keywordFinish String? @db.VarChar(100)
380
+ delayMessage Int? @db.Int
381
+ unknownMessage String? @db.VarChar(100)
382
+ listeningFromMe Boolean? @default(false)
383
+ stopBotFromMe Boolean? @default(false)
384
+ keepOpen Boolean? @default(false)
385
+ debounceTime Int? @db.Int
386
+ typebotIdFallback String? @db.VarChar(100)
387
+ ignoreJids Json?
388
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
389
+ updatedAt DateTime @updatedAt @db.Timestamp
390
+ Fallback Typebot? @relation(fields: [typebotIdFallback], references: [id])
391
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
392
+ instanceId String @unique
393
+ }
394
+
395
+ model IntegrationSession {
396
+ id String @id @default(cuid())
397
+ sessionId String @db.VarChar(255)
398
+ remoteJid String @db.VarChar(100)
399
+ pushName String?
400
+ status SessionStatus
401
+ awaitUser Boolean @default(false)
402
+ context Json?
403
+ type String? @db.VarChar(100)
404
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
405
+ updatedAt DateTime @updatedAt @db.Timestamp
406
+ Message Message[]
407
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
408
+ instanceId String
409
+ parameters Json?
410
+
411
+ botId String?
412
+ }
413
+
414
+ model Media {
415
+ id String @id @default(cuid())
416
+ fileName String @db.VarChar(500)
417
+ type String @db.VarChar(100)
418
+ mimetype String @db.VarChar(100)
419
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
420
+ Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
421
+ messageId String @unique
422
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
423
+ instanceId String
424
+ }
425
+
426
+ model OpenaiCreds {
427
+ id String @id @default(cuid())
428
+ name String? @unique @db.VarChar(255)
429
+ apiKey String? @unique @db.VarChar(255)
430
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
431
+ updatedAt DateTime @updatedAt @db.Timestamp
432
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
433
+ instanceId String
434
+ OpenaiAssistant OpenaiBot[]
435
+ OpenaiSetting OpenaiSetting?
436
+ }
437
+
438
+ model OpenaiBot {
439
+ id String @id @default(cuid())
440
+ enabled Boolean @default(true)
441
+ description String? @db.VarChar(255)
442
+ botType OpenaiBotType
443
+ assistantId String? @db.VarChar(255)
444
+ functionUrl String? @db.VarChar(500)
445
+ model String? @db.VarChar(100)
446
+ systemMessages Json? @db.Json
447
+ assistantMessages Json? @db.Json
448
+ userMessages Json? @db.Json
449
+ maxTokens Int? @db.Int
450
+ expire Int? @default(0) @db.Int
451
+ keywordFinish String? @db.VarChar(100)
452
+ delayMessage Int? @db.Int
453
+ unknownMessage String? @db.VarChar(100)
454
+ listeningFromMe Boolean? @default(false)
455
+ stopBotFromMe Boolean? @default(false)
456
+ keepOpen Boolean? @default(false)
457
+ debounceTime Int? @db.Int
458
+ ignoreJids Json?
459
+ splitMessages Boolean? @default(false)
460
+ timePerChar Int? @default(50) @db.Int
461
+ triggerType TriggerType?
462
+ triggerOperator TriggerOperator?
463
+ triggerValue String?
464
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
465
+ updatedAt DateTime @updatedAt @db.Timestamp
466
+ OpenaiCreds OpenaiCreds @relation(fields: [openaiCredsId], references: [id], onDelete: Cascade)
467
+ openaiCredsId String
468
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
469
+ instanceId String
470
+ OpenaiSetting OpenaiSetting[]
471
+ }
472
+
473
+ model OpenaiSetting {
474
+ id String @id @default(cuid())
475
+ expire Int? @default(0) @db.Int
476
+ keywordFinish String? @db.VarChar(100)
477
+ delayMessage Int? @db.Int
478
+ unknownMessage String? @db.VarChar(100)
479
+ listeningFromMe Boolean? @default(false)
480
+ stopBotFromMe Boolean? @default(false)
481
+ keepOpen Boolean? @default(false)
482
+ debounceTime Int? @db.Int
483
+ ignoreJids Json?
484
+ splitMessages Boolean? @default(false)
485
+ timePerChar Int? @default(50) @db.Int
486
+ speechToText Boolean? @default(false)
487
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
488
+ updatedAt DateTime @updatedAt @db.Timestamp
489
+ OpenaiCreds OpenaiCreds? @relation(fields: [openaiCredsId], references: [id])
490
+ openaiCredsId String @unique
491
+ Fallback OpenaiBot? @relation(fields: [openaiIdFallback], references: [id])
492
+ openaiIdFallback String? @db.VarChar(100)
493
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
494
+ instanceId String @unique
495
+ }
496
+
497
+ model Template {
498
+ id String @id @default(cuid())
499
+ templateId String @unique @db.VarChar(255)
500
+ name String @unique @db.VarChar(255)
501
+ template Json @db.Json
502
+ webhookUrl String? @db.VarChar(500)
503
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
504
+ updatedAt DateTime @updatedAt @db.Timestamp
505
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
506
+ instanceId String
507
+ }
508
+
509
+ model Dify {
510
+ id String @id @default(cuid())
511
+ enabled Boolean @default(true)
512
+ description String? @db.VarChar(255)
513
+ botType DifyBotType
514
+ apiUrl String? @db.VarChar(255)
515
+ apiKey String? @db.VarChar(255)
516
+ expire Int? @default(0) @db.Int
517
+ keywordFinish String? @db.VarChar(100)
518
+ delayMessage Int? @db.Int
519
+ unknownMessage String? @db.VarChar(100)
520
+ listeningFromMe Boolean? @default(false)
521
+ stopBotFromMe Boolean? @default(false)
522
+ keepOpen Boolean? @default(false)
523
+ debounceTime Int? @db.Int
524
+ ignoreJids Json?
525
+ splitMessages Boolean? @default(false)
526
+ timePerChar Int? @default(50) @db.Int
527
+ triggerType TriggerType?
528
+ triggerOperator TriggerOperator?
529
+ triggerValue String?
530
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
531
+ updatedAt DateTime @updatedAt @db.Timestamp
532
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
533
+ instanceId String
534
+ DifySetting DifySetting[]
535
+ }
536
+
537
+ model DifySetting {
538
+ id String @id @default(cuid())
539
+ expire Int? @default(0) @db.Int
540
+ keywordFinish String? @db.VarChar(100)
541
+ delayMessage Int? @db.Int
542
+ unknownMessage String? @db.VarChar(100)
543
+ listeningFromMe Boolean? @default(false)
544
+ stopBotFromMe Boolean? @default(false)
545
+ keepOpen Boolean? @default(false)
546
+ debounceTime Int? @db.Int
547
+ ignoreJids Json?
548
+ splitMessages Boolean? @default(false)
549
+ timePerChar Int? @default(50) @db.Int
550
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
551
+ updatedAt DateTime @updatedAt @db.Timestamp
552
+ Fallback Dify? @relation(fields: [difyIdFallback], references: [id])
553
+ difyIdFallback String? @db.VarChar(100)
554
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
555
+ instanceId String @unique
556
+ }
557
+
558
+ model EvolutionBot {
559
+ id String @id @default(cuid())
560
+ enabled Boolean @default(true)
561
+ description String? @db.VarChar(255)
562
+ apiUrl String? @db.VarChar(255)
563
+ apiKey String? @db.VarChar(255)
564
+ expire Int? @default(0) @db.Int
565
+ keywordFinish String? @db.VarChar(100)
566
+ delayMessage Int? @db.Int
567
+ unknownMessage String? @db.VarChar(100)
568
+ listeningFromMe Boolean? @default(false)
569
+ stopBotFromMe Boolean? @default(false)
570
+ keepOpen Boolean? @default(false)
571
+ debounceTime Int? @db.Int
572
+ ignoreJids Json?
573
+ splitMessages Boolean? @default(false)
574
+ timePerChar Int? @default(50) @db.Int
575
+ triggerType TriggerType?
576
+ triggerOperator TriggerOperator?
577
+ triggerValue String?
578
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
579
+ updatedAt DateTime @updatedAt @db.Timestamp
580
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
581
+ instanceId String
582
+ EvolutionBotSetting EvolutionBotSetting[]
583
+ }
584
+
585
+ model EvolutionBotSetting {
586
+ id String @id @default(cuid())
587
+ expire Int? @default(0) @db.Int
588
+ keywordFinish String? @db.VarChar(100)
589
+ delayMessage Int? @db.Int
590
+ unknownMessage String? @db.VarChar(100)
591
+ listeningFromMe Boolean? @default(false)
592
+ stopBotFromMe Boolean? @default(false)
593
+ keepOpen Boolean? @default(false)
594
+ debounceTime Int? @db.Int
595
+ ignoreJids Json?
596
+ splitMessages Boolean? @default(false)
597
+ timePerChar Int? @default(50) @db.Int
598
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
599
+ updatedAt DateTime @updatedAt @db.Timestamp
600
+ Fallback EvolutionBot? @relation(fields: [botIdFallback], references: [id])
601
+ botIdFallback String? @db.VarChar(100)
602
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
603
+ instanceId String @unique
604
+ }
605
+
606
+ model Flowise {
607
+ id String @id @default(cuid())
608
+ enabled Boolean @default(true)
609
+ description String? @db.VarChar(255)
610
+ apiUrl String? @db.VarChar(255)
611
+ apiKey String? @db.VarChar(255)
612
+ expire Int? @default(0) @db.Int
613
+ keywordFinish String? @db.VarChar(100)
614
+ delayMessage Int? @db.Int
615
+ unknownMessage String? @db.VarChar(100)
616
+ listeningFromMe Boolean? @default(false)
617
+ stopBotFromMe Boolean? @default(false)
618
+ keepOpen Boolean? @default(false)
619
+ debounceTime Int? @db.Int
620
+ ignoreJids Json?
621
+ splitMessages Boolean? @default(false)
622
+ timePerChar Int? @default(50) @db.Int
623
+ triggerType TriggerType?
624
+ triggerOperator TriggerOperator?
625
+ triggerValue String?
626
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
627
+ updatedAt DateTime @updatedAt @db.Timestamp
628
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
629
+ instanceId String
630
+ FlowiseSetting FlowiseSetting[]
631
+ }
632
+
633
+ model FlowiseSetting {
634
+ id String @id @default(cuid())
635
+ expire Int? @default(0) @db.Int
636
+ keywordFinish String? @db.VarChar(100)
637
+ delayMessage Int? @db.Int
638
+ unknownMessage String? @db.VarChar(100)
639
+ listeningFromMe Boolean? @default(false)
640
+ stopBotFromMe Boolean? @default(false)
641
+ keepOpen Boolean? @default(false)
642
+ debounceTime Int? @db.Int
643
+ ignoreJids Json?
644
+ splitMessages Boolean? @default(false)
645
+ timePerChar Int? @default(50) @db.Int
646
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
647
+ updatedAt DateTime @updatedAt @db.Timestamp
648
+ Fallback Flowise? @relation(fields: [flowiseIdFallback], references: [id])
649
+ flowiseIdFallback String? @db.VarChar(100)
650
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
651
+ instanceId String @unique
652
+ }
653
+
654
+ model IsOnWhatsapp {
655
+ id String @id @default(cuid())
656
+ remoteJid String @unique @db.VarChar(100)
657
+ jidOptions String
658
+ createdAt DateTime @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
659
+ updatedAt DateTime @updatedAt @db.Timestamp
660
+ }
661
+
662
+ model N8n {
663
+ id String @id @default(cuid())
664
+ enabled Boolean @default(true) @db.TinyInt()
665
+ description String? @db.VarChar(255)
666
+ webhookUrl String? @db.VarChar(255)
667
+ basicAuthUser String? @db.VarChar(255)
668
+ basicAuthPass String? @db.VarChar(255)
669
+ expire Int? @default(0) @db.Int
670
+ keywordFinish String? @db.VarChar(100)
671
+ delayMessage Int? @db.Int
672
+ unknownMessage String? @db.VarChar(100)
673
+ listeningFromMe Boolean? @default(false)
674
+ stopBotFromMe Boolean? @default(false)
675
+ keepOpen Boolean? @default(false)
676
+ debounceTime Int? @db.Int
677
+ ignoreJids Json?
678
+ splitMessages Boolean? @default(false)
679
+ timePerChar Int? @default(50) @db.Int
680
+ triggerType TriggerType?
681
+ triggerOperator TriggerOperator?
682
+ triggerValue String?
683
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
684
+ updatedAt DateTime @updatedAt @db.Timestamp
685
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
686
+ instanceId String
687
+ N8nSetting N8nSetting[]
688
+ }
689
+
690
+ model N8nSetting {
691
+ id String @id @default(cuid())
692
+ expire Int? @default(0) @db.Int
693
+ keywordFinish String? @db.VarChar(100)
694
+ delayMessage Int? @db.Int
695
+ unknownMessage String? @db.VarChar(100)
696
+ listeningFromMe Boolean? @default(false)
697
+ stopBotFromMe Boolean? @default(false)
698
+ keepOpen Boolean? @default(false)
699
+ debounceTime Int? @db.Int
700
+ ignoreJids Json?
701
+ splitMessages Boolean? @default(false)
702
+ timePerChar Int? @default(50) @db.Int
703
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
704
+ updatedAt DateTime @updatedAt @db.Timestamp
705
+ Fallback N8n? @relation(fields: [n8nIdFallback], references: [id])
706
+ n8nIdFallback String? @db.VarChar(100)
707
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
708
+ instanceId String @unique
709
+ }
710
+
711
+ model Evoai {
712
+ id String @id @default(cuid())
713
+ enabled Boolean @default(true) @db.TinyInt()
714
+ description String? @db.VarChar(255)
715
+ agentUrl String? @db.VarChar(255)
716
+ apiKey String? @db.VarChar(255)
717
+ expire Int? @default(0) @db.Int
718
+ keywordFinish String? @db.VarChar(100)
719
+ delayMessage Int? @db.Int
720
+ unknownMessage String? @db.VarChar(100)
721
+ listeningFromMe Boolean? @default(false)
722
+ stopBotFromMe Boolean? @default(false)
723
+ keepOpen Boolean? @default(false)
724
+ debounceTime Int? @db.Int
725
+ ignoreJids Json?
726
+ splitMessages Boolean? @default(false)
727
+ timePerChar Int? @default(50) @db.Int
728
+ triggerType TriggerType?
729
+ triggerOperator TriggerOperator?
730
+ triggerValue String?
731
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
732
+ updatedAt DateTime @updatedAt @db.Timestamp
733
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
734
+ instanceId String
735
+ EvoaiSetting EvoaiSetting[]
736
+ }
737
+
738
+ model EvoaiSetting {
739
+ id String @id @default(cuid())
740
+ expire Int? @default(0) @db.Int
741
+ keywordFinish String? @db.VarChar(100)
742
+ delayMessage Int? @db.Int
743
+ unknownMessage String? @db.VarChar(100)
744
+ listeningFromMe Boolean? @default(false)
745
+ stopBotFromMe Boolean? @default(false)
746
+ keepOpen Boolean? @default(false)
747
+ debounceTime Int? @db.Int
748
+ ignoreJids Json?
749
+ splitMessages Boolean? @default(false)
750
+ timePerChar Int? @default(50) @db.Int
751
+ createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
752
+ updatedAt DateTime @updatedAt @db.Timestamp
753
+ Fallback Evoai? @relation(fields: [evoaiIdFallback], references: [id])
754
+ evoaiIdFallback String? @db.VarChar(100)
755
+ Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
756
+ instanceId String @unique
757
+ }
prisma/postgresql-migrations/20240609181238_init/migration.sql ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateEnum
2
+ CREATE TYPE "InstanceConnectionStatus" AS ENUM ('open', 'close', 'connecting');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "DeviceMessage" AS ENUM ('ios', 'android', 'web', 'unknown', 'desktop');
6
+
7
+ -- CreateEnum
8
+ CREATE TYPE "TypebotSessionStatus" AS ENUM ('open', 'closed', 'paused');
9
+
10
+ -- CreateEnum
11
+ CREATE TYPE "TriggerType" AS ENUM ('all', 'keyword');
12
+
13
+ -- CreateEnum
14
+ CREATE TYPE "TriggerOperator" AS ENUM ('contains', 'equals', 'startsWith', 'endsWith');
15
+
16
+ -- CreateTable
17
+ CREATE TABLE "Instance" (
18
+ "id" TEXT NOT NULL,
19
+ "name" VARCHAR(255) NOT NULL,
20
+ "connectionStatus" "InstanceConnectionStatus" NOT NULL DEFAULT 'open',
21
+ "ownerJid" VARCHAR(100),
22
+ "profilePicUrl" VARCHAR(500),
23
+ "integration" VARCHAR(100),
24
+ "number" VARCHAR(100),
25
+ "token" VARCHAR(255),
26
+ "clientName" VARCHAR(100),
27
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
28
+ "updatedAt" TIMESTAMP,
29
+
30
+ CONSTRAINT "Instance_pkey" PRIMARY KEY ("id")
31
+ );
32
+
33
+ -- CreateTable
34
+ CREATE TABLE "Session" (
35
+ "id" TEXT NOT NULL,
36
+ "sessionId" TEXT NOT NULL,
37
+ "creds" TEXT,
38
+ "createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
39
+
40
+ CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
41
+ );
42
+
43
+ -- CreateTable
44
+ CREATE TABLE "Chat" (
45
+ "id" TEXT NOT NULL,
46
+ "remoteJid" VARCHAR(100) NOT NULL,
47
+ "labels" JSONB,
48
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
49
+ "updatedAt" TIMESTAMP,
50
+ "instanceId" TEXT NOT NULL,
51
+
52
+ CONSTRAINT "Chat_pkey" PRIMARY KEY ("id")
53
+ );
54
+
55
+ -- CreateTable
56
+ CREATE TABLE "Contact" (
57
+ "id" TEXT NOT NULL,
58
+ "remoteJid" VARCHAR(100) NOT NULL,
59
+ "pushName" VARCHAR(100),
60
+ "profilePicUrl" VARCHAR(500),
61
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
62
+ "updatedAt" TIMESTAMP,
63
+ "instanceId" TEXT NOT NULL,
64
+
65
+ CONSTRAINT "Contact_pkey" PRIMARY KEY ("id")
66
+ );
67
+
68
+ -- CreateTable
69
+ CREATE TABLE "Message" (
70
+ "id" TEXT NOT NULL,
71
+ "key" JSONB NOT NULL,
72
+ "pushName" VARCHAR(100),
73
+ "participant" VARCHAR(100),
74
+ "messageType" VARCHAR(100) NOT NULL,
75
+ "message" JSONB NOT NULL,
76
+ "contextInfo" JSONB,
77
+ "source" "DeviceMessage" NOT NULL,
78
+ "messageTimestamp" INTEGER NOT NULL,
79
+ "chatwootMessageId" INTEGER,
80
+ "chatwootInboxId" INTEGER,
81
+ "chatwootConversationId" INTEGER,
82
+ "chatwootContactInboxSourceId" VARCHAR(100),
83
+ "chatwootIsRead" BOOLEAN,
84
+ "instanceId" TEXT NOT NULL,
85
+ "typebotSessionId" TEXT,
86
+
87
+ CONSTRAINT "Message_pkey" PRIMARY KEY ("id")
88
+ );
89
+
90
+ -- CreateTable
91
+ CREATE TABLE "MessageUpdate" (
92
+ "id" TEXT NOT NULL,
93
+ "keyId" VARCHAR(100) NOT NULL,
94
+ "remoteJid" VARCHAR(100) NOT NULL,
95
+ "fromMe" BOOLEAN NOT NULL,
96
+ "participant" VARCHAR(100),
97
+ "pollUpdates" JSONB,
98
+ "status" VARCHAR(30) NOT NULL,
99
+ "messageId" TEXT NOT NULL,
100
+ "instanceId" TEXT NOT NULL,
101
+
102
+ CONSTRAINT "MessageUpdate_pkey" PRIMARY KEY ("id")
103
+ );
104
+
105
+ -- CreateTable
106
+ CREATE TABLE "Webhook" (
107
+ "id" TEXT NOT NULL,
108
+ "url" VARCHAR(500) NOT NULL,
109
+ "enabled" BOOLEAN DEFAULT true,
110
+ "events" JSONB,
111
+ "webhookByEvents" BOOLEAN DEFAULT false,
112
+ "webhookBase64" BOOLEAN DEFAULT false,
113
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
114
+ "updatedAt" TIMESTAMP NOT NULL,
115
+ "instanceId" TEXT NOT NULL,
116
+
117
+ CONSTRAINT "Webhook_pkey" PRIMARY KEY ("id")
118
+ );
119
+
120
+ -- CreateTable
121
+ CREATE TABLE "Chatwoot" (
122
+ "id" TEXT NOT NULL,
123
+ "enabled" BOOLEAN DEFAULT true,
124
+ "accountId" VARCHAR(100),
125
+ "token" VARCHAR(100),
126
+ "url" VARCHAR(500),
127
+ "nameInbox" VARCHAR(100),
128
+ "signMsg" BOOLEAN DEFAULT false,
129
+ "signDelimiter" VARCHAR(100),
130
+ "number" VARCHAR(100),
131
+ "reopenConversation" BOOLEAN DEFAULT false,
132
+ "conversationPending" BOOLEAN DEFAULT false,
133
+ "mergeBrazilContacts" BOOLEAN DEFAULT false,
134
+ "importContacts" BOOLEAN DEFAULT false,
135
+ "importMessages" BOOLEAN DEFAULT false,
136
+ "daysLimitImportMessages" INTEGER,
137
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
138
+ "updatedAt" TIMESTAMP NOT NULL,
139
+ "instanceId" TEXT NOT NULL,
140
+
141
+ CONSTRAINT "Chatwoot_pkey" PRIMARY KEY ("id")
142
+ );
143
+
144
+ -- CreateTable
145
+ CREATE TABLE "Label" (
146
+ "id" TEXT NOT NULL,
147
+ "labelId" VARCHAR(100),
148
+ "name" VARCHAR(100) NOT NULL,
149
+ "color" VARCHAR(100) NOT NULL,
150
+ "predefinedId" VARCHAR(100),
151
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
152
+ "updatedAt" TIMESTAMP NOT NULL,
153
+ "instanceId" TEXT NOT NULL,
154
+
155
+ CONSTRAINT "Label_pkey" PRIMARY KEY ("id")
156
+ );
157
+
158
+ -- CreateTable
159
+ CREATE TABLE "Proxy" (
160
+ "id" TEXT NOT NULL,
161
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
162
+ "host" VARCHAR(100) NOT NULL,
163
+ "port" VARCHAR(100) NOT NULL,
164
+ "protocol" VARCHAR(100) NOT NULL,
165
+ "username" VARCHAR(100) NOT NULL,
166
+ "password" VARCHAR(100) NOT NULL,
167
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
168
+ "updatedAt" TIMESTAMP NOT NULL,
169
+ "instanceId" TEXT NOT NULL,
170
+
171
+ CONSTRAINT "Proxy_pkey" PRIMARY KEY ("id")
172
+ );
173
+
174
+ -- CreateTable
175
+ CREATE TABLE "Setting" (
176
+ "id" TEXT NOT NULL,
177
+ "rejectCall" BOOLEAN NOT NULL DEFAULT false,
178
+ "msgCall" VARCHAR(100),
179
+ "groupsIgnore" BOOLEAN NOT NULL DEFAULT false,
180
+ "alwaysOnline" BOOLEAN NOT NULL DEFAULT false,
181
+ "readMessages" BOOLEAN NOT NULL DEFAULT false,
182
+ "readStatus" BOOLEAN NOT NULL DEFAULT false,
183
+ "syncFullHistory" BOOLEAN NOT NULL DEFAULT false,
184
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
185
+ "updatedAt" TIMESTAMP NOT NULL,
186
+ "instanceId" TEXT NOT NULL,
187
+
188
+ CONSTRAINT "Setting_pkey" PRIMARY KEY ("id")
189
+ );
190
+
191
+ -- CreateTable
192
+ CREATE TABLE "Rabbitmq" (
193
+ "id" TEXT NOT NULL,
194
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
195
+ "events" JSONB NOT NULL,
196
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
197
+ "updatedAt" TIMESTAMP NOT NULL,
198
+ "instanceId" TEXT NOT NULL,
199
+
200
+ CONSTRAINT "Rabbitmq_pkey" PRIMARY KEY ("id")
201
+ );
202
+
203
+ -- CreateTable
204
+ CREATE TABLE "Sqs" (
205
+ "id" TEXT NOT NULL,
206
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
207
+ "events" JSONB NOT NULL,
208
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
209
+ "updatedAt" TIMESTAMP NOT NULL,
210
+ "instanceId" TEXT NOT NULL,
211
+
212
+ CONSTRAINT "Sqs_pkey" PRIMARY KEY ("id")
213
+ );
214
+
215
+ -- CreateTable
216
+ CREATE TABLE "Websocket" (
217
+ "id" TEXT NOT NULL,
218
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
219
+ "events" JSONB NOT NULL,
220
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
221
+ "updatedAt" TIMESTAMP NOT NULL,
222
+ "instanceId" TEXT NOT NULL,
223
+
224
+ CONSTRAINT "Websocket_pkey" PRIMARY KEY ("id")
225
+ );
226
+
227
+ -- CreateTable
228
+ CREATE TABLE "Typebot" (
229
+ "id" TEXT NOT NULL,
230
+ "enabled" BOOLEAN NOT NULL DEFAULT true,
231
+ "url" VARCHAR(500) NOT NULL,
232
+ "typebot" VARCHAR(100) NOT NULL,
233
+ "expire" INTEGER DEFAULT 0,
234
+ "keywordFinish" VARCHAR(100),
235
+ "delayMessage" INTEGER,
236
+ "unknownMessage" VARCHAR(100),
237
+ "listeningFromMe" BOOLEAN DEFAULT false,
238
+ "stopBotFromMe" BOOLEAN DEFAULT false,
239
+ "keepOpen" BOOLEAN DEFAULT false,
240
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
241
+ "updatedAt" TIMESTAMP,
242
+ "triggerType" "TriggerType",
243
+ "triggerOperator" "TriggerOperator",
244
+ "triggerValue" TEXT,
245
+ "instanceId" TEXT NOT NULL,
246
+
247
+ CONSTRAINT "Typebot_pkey" PRIMARY KEY ("id")
248
+ );
249
+
250
+ -- CreateTable
251
+ CREATE TABLE "TypebotSession" (
252
+ "id" TEXT NOT NULL,
253
+ "remoteJid" VARCHAR(100) NOT NULL,
254
+ "pushName" VARCHAR(100),
255
+ "sessionId" VARCHAR(100) NOT NULL,
256
+ "status" VARCHAR(100) NOT NULL,
257
+ "prefilledVariables" JSONB,
258
+ "awaitUser" BOOLEAN NOT NULL DEFAULT false,
259
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
260
+ "updatedAt" TIMESTAMP NOT NULL,
261
+ "typebotId" TEXT NOT NULL,
262
+ "instanceId" TEXT NOT NULL,
263
+
264
+ CONSTRAINT "TypebotSession_pkey" PRIMARY KEY ("id")
265
+ );
266
+
267
+ -- CreateTable
268
+ CREATE TABLE "TypebotSetting" (
269
+ "id" TEXT NOT NULL,
270
+ "expire" INTEGER DEFAULT 0,
271
+ "keywordFinish" VARCHAR(100),
272
+ "delayMessage" INTEGER,
273
+ "unknownMessage" VARCHAR(100),
274
+ "listeningFromMe" BOOLEAN DEFAULT false,
275
+ "stopBotFromMe" BOOLEAN DEFAULT false,
276
+ "keepOpen" BOOLEAN DEFAULT false,
277
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
278
+ "updatedAt" TIMESTAMP NOT NULL,
279
+ "instanceId" TEXT NOT NULL,
280
+
281
+ CONSTRAINT "TypebotSetting_pkey" PRIMARY KEY ("id")
282
+ );
283
+
284
+ -- CreateIndex
285
+ CREATE UNIQUE INDEX "Instance_name_key" ON "Instance"("name");
286
+
287
+ -- CreateIndex
288
+ CREATE UNIQUE INDEX "Instance_token_key" ON "Instance"("token");
289
+
290
+ -- CreateIndex
291
+ CREATE UNIQUE INDEX "Session_sessionId_key" ON "Session"("sessionId");
292
+
293
+ -- CreateIndex
294
+ CREATE UNIQUE INDEX "Webhook_instanceId_key" ON "Webhook"("instanceId");
295
+
296
+ -- CreateIndex
297
+ CREATE UNIQUE INDEX "Chatwoot_instanceId_key" ON "Chatwoot"("instanceId");
298
+
299
+ -- CreateIndex
300
+ CREATE UNIQUE INDEX "Label_labelId_key" ON "Label"("labelId");
301
+
302
+ -- CreateIndex
303
+ CREATE UNIQUE INDEX "Proxy_instanceId_key" ON "Proxy"("instanceId");
304
+
305
+ -- CreateIndex
306
+ CREATE UNIQUE INDEX "Setting_instanceId_key" ON "Setting"("instanceId");
307
+
308
+ -- CreateIndex
309
+ CREATE UNIQUE INDEX "Rabbitmq_instanceId_key" ON "Rabbitmq"("instanceId");
310
+
311
+ -- CreateIndex
312
+ CREATE UNIQUE INDEX "Sqs_instanceId_key" ON "Sqs"("instanceId");
313
+
314
+ -- CreateIndex
315
+ CREATE UNIQUE INDEX "Websocket_instanceId_key" ON "Websocket"("instanceId");
316
+
317
+ -- CreateIndex
318
+ CREATE UNIQUE INDEX "TypebotSetting_instanceId_key" ON "TypebotSetting"("instanceId");
319
+
320
+ -- AddForeignKey
321
+ ALTER TABLE "Session" ADD CONSTRAINT "Session_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
322
+
323
+ -- AddForeignKey
324
+ ALTER TABLE "Chat" ADD CONSTRAINT "Chat_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
325
+
326
+ -- AddForeignKey
327
+ ALTER TABLE "Contact" ADD CONSTRAINT "Contact_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
328
+
329
+ -- AddForeignKey
330
+ ALTER TABLE "Message" ADD CONSTRAINT "Message_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
331
+
332
+ -- AddForeignKey
333
+ ALTER TABLE "Message" ADD CONSTRAINT "Message_typebotSessionId_fkey" FOREIGN KEY ("typebotSessionId") REFERENCES "TypebotSession"("id") ON DELETE SET NULL ON UPDATE CASCADE;
334
+
335
+ -- AddForeignKey
336
+ ALTER TABLE "MessageUpdate" ADD CONSTRAINT "MessageUpdate_messageId_fkey" FOREIGN KEY ("messageId") REFERENCES "Message"("id") ON DELETE CASCADE ON UPDATE CASCADE;
337
+
338
+ -- AddForeignKey
339
+ ALTER TABLE "MessageUpdate" ADD CONSTRAINT "MessageUpdate_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
340
+
341
+ -- AddForeignKey
342
+ ALTER TABLE "Webhook" ADD CONSTRAINT "Webhook_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
343
+
344
+ -- AddForeignKey
345
+ ALTER TABLE "Chatwoot" ADD CONSTRAINT "Chatwoot_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
346
+
347
+ -- AddForeignKey
348
+ ALTER TABLE "Label" ADD CONSTRAINT "Label_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
349
+
350
+ -- AddForeignKey
351
+ ALTER TABLE "Proxy" ADD CONSTRAINT "Proxy_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
352
+
353
+ -- AddForeignKey
354
+ ALTER TABLE "Setting" ADD CONSTRAINT "Setting_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
355
+
356
+ -- AddForeignKey
357
+ ALTER TABLE "Rabbitmq" ADD CONSTRAINT "Rabbitmq_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
358
+
359
+ -- AddForeignKey
360
+ ALTER TABLE "Sqs" ADD CONSTRAINT "Sqs_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
361
+
362
+ -- AddForeignKey
363
+ ALTER TABLE "Websocket" ADD CONSTRAINT "Websocket_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
364
+
365
+ -- AddForeignKey
366
+ ALTER TABLE "Typebot" ADD CONSTRAINT "Typebot_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
367
+
368
+ -- AddForeignKey
369
+ ALTER TABLE "TypebotSession" ADD CONSTRAINT "TypebotSession_typebotId_fkey" FOREIGN KEY ("typebotId") REFERENCES "Typebot"("id") ON DELETE CASCADE ON UPDATE CASCADE;
370
+
371
+ -- AddForeignKey
372
+ ALTER TABLE "TypebotSession" ADD CONSTRAINT "TypebotSession_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
373
+
374
+ -- AddForeignKey
375
+ ALTER TABLE "TypebotSetting" ADD CONSTRAINT "TypebotSetting_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
prisma/postgresql-migrations/20240610144159_create_column_profile_name_instance/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Instance" ADD COLUMN "profileName" VARCHAR(100);
prisma/postgresql-migrations/20240611125754_create_columns_whitelabel_chatwoot/migration.sql ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Chatwoot" ADD COLUMN "logo" VARCHAR(500),
3
+ ADD COLUMN "organization" VARCHAR(100);
prisma/postgresql-migrations/20240611202817_create_columns_debounce_time_typebot/migration.sql ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Typebot" ADD COLUMN "debounceTime" INTEGER;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "TypebotSetting" ADD COLUMN "debounceTime" INTEGER;
prisma/postgresql-migrations/20240712144948_add_business_id_column_to_instances/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Instance" ADD COLUMN "businessId" VARCHAR(100);
prisma/postgresql-migrations/20240712150256_create_templates_table/migration.sql ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE "Template" (
3
+ "id" TEXT NOT NULL,
4
+ "name" VARCHAR(255) NOT NULL,
5
+ "language" VARCHAR(255) NOT NULL,
6
+ "templateId" VARCHAR(255) NOT NULL,
7
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
8
+ "updatedAt" TIMESTAMP NOT NULL,
9
+ "instanceId" TEXT NOT NULL,
10
+
11
+ CONSTRAINT "Template_pkey" PRIMARY KEY ("id")
12
+ );
13
+
14
+ -- CreateIndex
15
+ CREATE UNIQUE INDEX "Template_templateId_key" ON "Template"("templateId");
16
+
17
+ -- CreateIndex
18
+ CREATE UNIQUE INDEX "Template_instanceId_key" ON "Template"("instanceId");
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "Template" ADD CONSTRAINT "Template_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
prisma/postgresql-migrations/20240712155950_adjusts_in_templates_table/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- DropIndex
2
+ DROP INDEX "Template_instanceId_key";
prisma/postgresql-migrations/20240712162206_remove_templates_table/migration.sql ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the `Template` table. If the table is not empty, all the data it contains will be lost.
5
+
6
+ */
7
+ -- DropForeignKey
8
+ ALTER TABLE "Template" DROP CONSTRAINT "Template_instanceId_fkey";
9
+
10
+ -- DropTable
11
+ DROP TABLE "Template";
prisma/postgresql-migrations/20240712223655_column_fallback_typebot/migration.sql ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ -- AlterEnum
2
+ ALTER TYPE "TriggerOperator" ADD VALUE 'regex';
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "TypebotSetting" ADD COLUMN "typebotIdFallback" VARCHAR(100);
6
+
7
+ -- AddForeignKey
8
+ ALTER TABLE "TypebotSetting" ADD CONSTRAINT "TypebotSetting_typebotIdFallback_fkey" FOREIGN KEY ("typebotIdFallback") REFERENCES "Typebot"("id") ON DELETE SET NULL ON UPDATE CASCADE;
prisma/postgresql-migrations/20240712230631_column_ignore_jids_typebot/migration.sql ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Typebot" ADD COLUMN "ignoreJids" JSONB;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "TypebotSetting" ADD COLUMN "ignoreJids" JSONB;
prisma/postgresql-migrations/20240713184337_add_media_table/migration.sql ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE "Media" (
3
+ "id" TEXT NOT NULL,
4
+ "fileName" VARCHAR(500) NOT NULL,
5
+ "type" VARCHAR(100) NOT NULL,
6
+ "mimetype" VARCHAR(100) NOT NULL,
7
+ "createdAt" DATE DEFAULT CURRENT_TIMESTAMP,
8
+ "messageId" TEXT NOT NULL,
9
+ "instanceId" TEXT NOT NULL,
10
+
11
+ CONSTRAINT "Media_pkey" PRIMARY KEY ("id")
12
+ );
13
+
14
+ -- CreateIndex
15
+ CREATE UNIQUE INDEX "Media_fileName_key" ON "Media"("fileName");
16
+
17
+ -- CreateIndex
18
+ CREATE UNIQUE INDEX "Media_messageId_key" ON "Media"("messageId");
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "Media" ADD CONSTRAINT "Media_messageId_fkey" FOREIGN KEY ("messageId") REFERENCES "Message"("id") ON DELETE CASCADE ON UPDATE CASCADE;
22
+
23
+ -- AddForeignKey
24
+ ALTER TABLE "Media" ADD CONSTRAINT "Media_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
prisma/postgresql-migrations/20240718121437_add_openai_tables/migration.sql ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Message" ADD COLUMN "openaiSessionId" TEXT;
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "OpenaiCreds" (
6
+ "id" TEXT NOT NULL,
7
+ "apiKey" VARCHAR(255) NOT NULL,
8
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
9
+ "updatedAt" TIMESTAMP NOT NULL,
10
+ "instanceId" TEXT NOT NULL,
11
+
12
+ CONSTRAINT "OpenaiCreds_pkey" PRIMARY KEY ("id")
13
+ );
14
+
15
+ -- CreateTable
16
+ CREATE TABLE "OpenaiBot" (
17
+ "id" TEXT NOT NULL,
18
+ "botType" VARCHAR(100) NOT NULL,
19
+ "assistantId" VARCHAR(255),
20
+ "model" VARCHAR(100),
21
+ "systemMessages" JSONB,
22
+ "assistantMessages" JSONB,
23
+ "userMessages" JSONB,
24
+ "maxTokens" INTEGER,
25
+ "expire" INTEGER DEFAULT 0,
26
+ "keywordFinish" VARCHAR(100),
27
+ "delayMessage" INTEGER,
28
+ "unknownMessage" VARCHAR(100),
29
+ "listeningFromMe" BOOLEAN DEFAULT false,
30
+ "stopBotFromMe" BOOLEAN DEFAULT false,
31
+ "keepOpen" BOOLEAN DEFAULT false,
32
+ "debounceTime" INTEGER,
33
+ "ignoreJids" JSONB,
34
+ "triggerType" "TriggerType",
35
+ "triggerOperator" "TriggerOperator",
36
+ "triggerValue" TEXT,
37
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
38
+ "updatedAt" TIMESTAMP NOT NULL,
39
+ "openaiCredsId" TEXT NOT NULL,
40
+ "instanceId" TEXT NOT NULL,
41
+
42
+ CONSTRAINT "OpenaiBot_pkey" PRIMARY KEY ("id")
43
+ );
44
+
45
+ -- CreateTable
46
+ CREATE TABLE "OpenaiSession" (
47
+ "id" TEXT NOT NULL,
48
+ "sessionId" VARCHAR(255) NOT NULL,
49
+ "remoteJid" VARCHAR(100) NOT NULL,
50
+ "status" "TypebotSessionStatus" NOT NULL,
51
+ "awaitUser" BOOLEAN NOT NULL DEFAULT false,
52
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
53
+ "updatedAt" TIMESTAMP NOT NULL,
54
+ "openaiBotId" TEXT NOT NULL,
55
+ "instanceId" TEXT NOT NULL,
56
+
57
+ CONSTRAINT "OpenaiSession_pkey" PRIMARY KEY ("id")
58
+ );
59
+
60
+ -- CreateTable
61
+ CREATE TABLE "OpenaiSetting" (
62
+ "id" TEXT NOT NULL,
63
+ "expire" INTEGER DEFAULT 0,
64
+ "keywordFinish" VARCHAR(100),
65
+ "delayMessage" INTEGER,
66
+ "unknownMessage" VARCHAR(100),
67
+ "listeningFromMe" BOOLEAN DEFAULT false,
68
+ "stopBotFromMe" BOOLEAN DEFAULT false,
69
+ "keepOpen" BOOLEAN DEFAULT false,
70
+ "debounceTime" INTEGER,
71
+ "ignoreJids" JSONB,
72
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
73
+ "updatedAt" TIMESTAMP NOT NULL,
74
+ "openaiCredsId" TEXT NOT NULL,
75
+ "openaiIdFallback" VARCHAR(100),
76
+ "instanceId" TEXT NOT NULL,
77
+
78
+ CONSTRAINT "OpenaiSetting_pkey" PRIMARY KEY ("id")
79
+ );
80
+
81
+ -- CreateIndex
82
+ CREATE UNIQUE INDEX "OpenaiCreds_apiKey_key" ON "OpenaiCreds"("apiKey");
83
+
84
+ -- CreateIndex
85
+ CREATE UNIQUE INDEX "OpenaiCreds_instanceId_key" ON "OpenaiCreds"("instanceId");
86
+
87
+ -- CreateIndex
88
+ CREATE UNIQUE INDEX "OpenaiBot_assistantId_key" ON "OpenaiBot"("assistantId");
89
+
90
+ -- CreateIndex
91
+ CREATE UNIQUE INDEX "OpenaiSetting_instanceId_key" ON "OpenaiSetting"("instanceId");
92
+
93
+ -- AddForeignKey
94
+ ALTER TABLE "Message" ADD CONSTRAINT "Message_openaiSessionId_fkey" FOREIGN KEY ("openaiSessionId") REFERENCES "OpenaiSession"("id") ON DELETE SET NULL ON UPDATE CASCADE;
95
+
96
+ -- AddForeignKey
97
+ ALTER TABLE "OpenaiCreds" ADD CONSTRAINT "OpenaiCreds_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
98
+
99
+ -- AddForeignKey
100
+ ALTER TABLE "OpenaiBot" ADD CONSTRAINT "OpenaiBot_openaiCredsId_fkey" FOREIGN KEY ("openaiCredsId") REFERENCES "OpenaiCreds"("id") ON DELETE CASCADE ON UPDATE CASCADE;
101
+
102
+ -- AddForeignKey
103
+ ALTER TABLE "OpenaiBot" ADD CONSTRAINT "OpenaiBot_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
104
+
105
+ -- AddForeignKey
106
+ ALTER TABLE "OpenaiSession" ADD CONSTRAINT "OpenaiSession_openaiBotId_fkey" FOREIGN KEY ("openaiBotId") REFERENCES "OpenaiBot"("id") ON DELETE CASCADE ON UPDATE CASCADE;
107
+
108
+ -- AddForeignKey
109
+ ALTER TABLE "OpenaiSession" ADD CONSTRAINT "OpenaiSession_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
110
+
111
+ -- AddForeignKey
112
+ ALTER TABLE "OpenaiSetting" ADD CONSTRAINT "OpenaiSetting_openaiCredsId_fkey" FOREIGN KEY ("openaiCredsId") REFERENCES "OpenaiCreds"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
113
+
114
+ -- AddForeignKey
115
+ ALTER TABLE "OpenaiSetting" ADD CONSTRAINT "OpenaiSetting_openaiIdFallback_fkey" FOREIGN KEY ("openaiIdFallback") REFERENCES "OpenaiBot"("id") ON DELETE SET NULL ON UPDATE CASCADE;
116
+
117
+ -- AddForeignKey
118
+ ALTER TABLE "OpenaiSetting" ADD CONSTRAINT "OpenaiSetting_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
prisma/postgresql-migrations/20240718123923_adjusts_openai_tables/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "OpenaiBot" ADD COLUMN "enabled" BOOLEAN NOT NULL DEFAULT true;
prisma/postgresql-migrations/20240722173259_add_name_column_to_openai_creds/migration.sql ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[name]` on the table `OpenaiCreds` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+ -- AlterTable
8
+ ALTER TABLE "OpenaiCreds" ADD COLUMN "name" VARCHAR(255),
9
+ ALTER COLUMN "apiKey" DROP NOT NULL;
10
+
11
+ -- CreateIndex
12
+ CREATE UNIQUE INDEX "OpenaiCreds_name_key" ON "OpenaiCreds"("name");
prisma/postgresql-migrations/20240722173518_add_name_column_to_openai_creds/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- DropIndex
2
+ DROP INDEX "OpenaiCreds_instanceId_key";
prisma/postgresql-migrations/20240723152648_adjusts_in_column_openai_creds/migration.sql ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[openaiCredsId]` on the table `OpenaiSetting` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+ -- CreateIndex
8
+ CREATE UNIQUE INDEX "OpenaiSetting_openaiCredsId_key" ON "OpenaiSetting"("openaiCredsId");
prisma/postgresql-migrations/20240723200254_add_webhookurl_on_message/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Message" ADD COLUMN "webhookUrl" VARCHAR(500);
prisma/postgresql-migrations/20240725184147_create_template_table/migration.sql ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- CreateTable
2
+ CREATE TABLE "Template" (
3
+ "id" TEXT NOT NULL,
4
+ "templateId" VARCHAR(255) NOT NULL,
5
+ "name" VARCHAR(255) NOT NULL,
6
+ "template" JSONB NOT NULL,
7
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
8
+ "updatedAt" TIMESTAMP NOT NULL,
9
+ "instanceId" TEXT NOT NULL,
10
+
11
+ CONSTRAINT "Template_pkey" PRIMARY KEY ("id")
12
+ );
13
+
14
+ -- CreateIndex
15
+ CREATE UNIQUE INDEX "Template_templateId_key" ON "Template"("templateId");
16
+
17
+ -- CreateIndex
18
+ CREATE UNIQUE INDEX "Template_name_key" ON "Template"("name");
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "Template" ADD CONSTRAINT "Template_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
prisma/postgresql-migrations/20240725202651_add_webhook_url_template_table/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Template" ADD COLUMN "webhookUrl" VARCHAR(500);
prisma/postgresql-migrations/20240725221646_modify_token_instance_table/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- DropIndex
2
+ DROP INDEX "Instance_token_key";
prisma/postgresql-migrations/20240729115127_modify_trigger_type_openai_typebot_table/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterEnum
2
+ ALTER TYPE "TriggerType" ADD VALUE 'none';
prisma/postgresql-migrations/20240729180347_modify_typebot_session_status_openai_typebot_table/migration.sql ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - The values [open] on the enum `TypebotSessionStatus` will be removed. If these variants are still used in the database, this will fail.
5
+ - Changed the type of `status` on the `TypebotSession` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
6
+
7
+ */
8
+ -- AlterEnum
9
+ BEGIN;
10
+ CREATE TYPE "TypebotSessionStatus_new" AS ENUM ('opened', 'closed', 'paused');
11
+ ALTER TABLE "TypebotSession" ALTER COLUMN "status" TYPE "TypebotSessionStatus_new" USING ("status"::text::"TypebotSessionStatus_new");
12
+ ALTER TABLE "OpenaiSession" ALTER COLUMN "status" TYPE "TypebotSessionStatus_new" USING ("status"::text::"TypebotSessionStatus_new");
13
+ ALTER TYPE "TypebotSessionStatus" RENAME TO "TypebotSessionStatus_old";
14
+ ALTER TYPE "TypebotSessionStatus_new" RENAME TO "TypebotSessionStatus";
15
+ DROP TYPE "TypebotSessionStatus_old";
16
+ COMMIT;
17
+
18
+ -- AlterTable
19
+ ALTER TABLE "TypebotSession" DROP COLUMN "status",
20
+ ADD COLUMN "status" "TypebotSessionStatus" NOT NULL;
prisma/postgresql-migrations/20240730152156_create_dify_tables/migration.sql ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - Changed the type of `botType` on the `OpenaiBot` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
5
+
6
+ */
7
+ -- CreateEnum
8
+ CREATE TYPE "OpenaiBotType" AS ENUM ('assistant', 'chatCompletion');
9
+
10
+ -- CreateEnum
11
+ CREATE TYPE "DifyBotType" AS ENUM ('chatBot', 'textGenerator', 'agent', 'workflow');
12
+
13
+ -- DropIndex
14
+ DROP INDEX "OpenaiBot_assistantId_key";
15
+
16
+ -- AlterTable
17
+ ALTER TABLE "Message" ADD COLUMN "difySessionId" TEXT;
18
+
19
+ -- AlterTable
20
+ ALTER TABLE "OpenaiBot" DROP COLUMN "botType",
21
+ ADD COLUMN "botType" "OpenaiBotType" NOT NULL;
22
+
23
+ -- CreateTable
24
+ CREATE TABLE "Dify" (
25
+ "id" TEXT NOT NULL,
26
+ "enabled" BOOLEAN NOT NULL DEFAULT true,
27
+ "botType" "DifyBotType" NOT NULL,
28
+ "apiUrl" VARCHAR(255),
29
+ "apiKey" VARCHAR(255),
30
+ "expire" INTEGER DEFAULT 0,
31
+ "keywordFinish" VARCHAR(100),
32
+ "delayMessage" INTEGER,
33
+ "unknownMessage" VARCHAR(100),
34
+ "listeningFromMe" BOOLEAN DEFAULT false,
35
+ "stopBotFromMe" BOOLEAN DEFAULT false,
36
+ "keepOpen" BOOLEAN DEFAULT false,
37
+ "debounceTime" INTEGER,
38
+ "ignoreJids" JSONB,
39
+ "triggerType" "TriggerType",
40
+ "triggerOperator" "TriggerOperator",
41
+ "triggerValue" TEXT,
42
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
43
+ "updatedAt" TIMESTAMP NOT NULL,
44
+ "instanceId" TEXT NOT NULL,
45
+
46
+ CONSTRAINT "Dify_pkey" PRIMARY KEY ("id")
47
+ );
48
+
49
+ -- CreateTable
50
+ CREATE TABLE "DifySession" (
51
+ "id" TEXT NOT NULL,
52
+ "sessionId" VARCHAR(255) NOT NULL,
53
+ "remoteJid" VARCHAR(100) NOT NULL,
54
+ "status" "TypebotSessionStatus" NOT NULL,
55
+ "awaitUser" BOOLEAN NOT NULL DEFAULT false,
56
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
57
+ "updatedAt" TIMESTAMP NOT NULL,
58
+ "difyId" TEXT NOT NULL,
59
+ "instanceId" TEXT NOT NULL,
60
+
61
+ CONSTRAINT "DifySession_pkey" PRIMARY KEY ("id")
62
+ );
63
+
64
+ -- CreateTable
65
+ CREATE TABLE "DifySetting" (
66
+ "id" TEXT NOT NULL,
67
+ "expire" INTEGER DEFAULT 0,
68
+ "keywordFinish" VARCHAR(100),
69
+ "delayMessage" INTEGER,
70
+ "unknownMessage" VARCHAR(100),
71
+ "listeningFromMe" BOOLEAN DEFAULT false,
72
+ "stopBotFromMe" BOOLEAN DEFAULT false,
73
+ "keepOpen" BOOLEAN DEFAULT false,
74
+ "debounceTime" INTEGER,
75
+ "ignoreJids" JSONB,
76
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
77
+ "updatedAt" TIMESTAMP NOT NULL,
78
+ "difyIdFallback" VARCHAR(100),
79
+ "instanceId" TEXT NOT NULL,
80
+
81
+ CONSTRAINT "DifySetting_pkey" PRIMARY KEY ("id")
82
+ );
83
+
84
+ -- CreateIndex
85
+ CREATE UNIQUE INDEX "DifySetting_instanceId_key" ON "DifySetting"("instanceId");
86
+
87
+ -- AddForeignKey
88
+ ALTER TABLE "Message" ADD CONSTRAINT "Message_difySessionId_fkey" FOREIGN KEY ("difySessionId") REFERENCES "DifySession"("id") ON DELETE SET NULL ON UPDATE CASCADE;
89
+
90
+ -- AddForeignKey
91
+ ALTER TABLE "Dify" ADD CONSTRAINT "Dify_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
92
+
93
+ -- AddForeignKey
94
+ ALTER TABLE "DifySession" ADD CONSTRAINT "DifySession_difyId_fkey" FOREIGN KEY ("difyId") REFERENCES "Dify"("id") ON DELETE CASCADE ON UPDATE CASCADE;
95
+
96
+ -- AddForeignKey
97
+ ALTER TABLE "DifySession" ADD CONSTRAINT "DifySession_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
98
+
99
+ -- AddForeignKey
100
+ ALTER TABLE "DifySetting" ADD CONSTRAINT "DifySetting_difyIdFallback_fkey" FOREIGN KEY ("difyIdFallback") REFERENCES "Dify"("id") ON DELETE SET NULL ON UPDATE CASCADE;
101
+
102
+ -- AddForeignKey
103
+ ALTER TABLE "DifySetting" ADD CONSTRAINT "DifySetting_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
prisma/postgresql-migrations/20240801193907_add_column_speech_to_text_openai_setting_table/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "OpenaiSetting" ADD COLUMN "speechToText" BOOLEAN DEFAULT false;
prisma/postgresql-migrations/20240803163908_add_column_description_on_integrations_table/migration.sql ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Dify" ADD COLUMN "description" VARCHAR(255);
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "OpenaiBot" ADD COLUMN "description" VARCHAR(255);
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "Typebot" ADD COLUMN "description" VARCHAR(255);
prisma/postgresql-migrations/20240808210239_add_column_function_url_openaibot_table/migration.sql ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Instance" ADD COLUMN "disconnectionAt" TIMESTAMP,
3
+ ADD COLUMN "disconnectionObject" JSONB,
4
+ ADD COLUMN "disconnectionReasonCode" INTEGER;
5
+
6
+ -- AlterTable
7
+ ALTER TABLE "OpenaiBot" ADD COLUMN "functionUrl" VARCHAR(500);
prisma/postgresql-migrations/20240811021156_add_chat_name_column/migration.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- AlterTable
2
+ ALTER TABLE "Chat" ADD COLUMN "name" VARCHAR(100);
prisma/postgresql-migrations/20240811183328_add_unique_index_for_remoted_jid_and_instance_in_contacts/migration.sql ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Contact` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+ -- Remove the duplicates
8
+ DELETE FROM "Contact"
9
+ WHERE ctid NOT IN (
10
+ SELECT min(ctid)
11
+ FROM "Contact"
12
+ GROUP BY "remoteJid", "instanceId"
13
+ );
14
+
15
+
16
+ -- CreateIndex
17
+ CREATE UNIQUE INDEX "Contact_remoteJid_instanceId_key" ON "Contact"("remoteJid", "instanceId");