Skip to content

Commit 8f855b4

Browse files
Merge pull request #1046 from rafwell/fixMessageStatus
Fix Message.Status as String
2 parents 084be1c + c8410bd commit 8f855b4

File tree

1 file changed

+232
-0
lines changed
  • prisma/mysql-migrations/20241108101333_fix_message_status_as_string

1 file changed

+232
-0
lines changed
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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`;

0 commit comments

Comments
 (0)