shubhjn commited on
Commit
943ba81
·
1 Parent(s): b8dc207

feat: Add social media and WhatsApp messaging tables, enhance workflow and user schemas, introduce new database indexes, and integrate Redis.

Browse files
db/schema/index.ts CHANGED
@@ -38,6 +38,14 @@ export const businesses = pgTable("businesses", {
38
  emailStatus: varchar("email_status", { length: 20 }),
39
  createdAt: timestamp("created_at").defaultNow().notNull(),
40
  updatedAt: timestamp("updated_at").defaultNow().notNull(),
 
 
 
 
 
 
 
 
41
  });
42
 
43
  export const emailTemplates = pgTable("email_templates", {
@@ -49,6 +57,11 @@ export const emailTemplates = pgTable("email_templates", {
49
  isDefault: boolean("is_default").default(false).notNull(),
50
  createdAt: timestamp("created_at").defaultNow().notNull(),
51
  updatedAt: timestamp("updated_at").defaultNow().notNull(),
 
 
 
 
 
52
  });
53
 
54
  export const automationWorkflows = pgTable("automation_workflows", {
@@ -89,6 +102,13 @@ export const emailLogs = pgTable("email_logs", {
89
  openedAt: timestamp("opened_at"),
90
  clickedAt: timestamp("clicked_at"),
91
  createdAt: timestamp("created_at").defaultNow().notNull(),
 
 
 
 
 
 
 
92
  });
93
 
94
  export const scrapingJobs = pgTable("scraping_jobs", {
@@ -193,7 +213,7 @@ export const workflowTriggerExecutions = pgTable("workflow_trigger_executions",
193
  }, (table) => {
194
  return {
195
  execTriggerIdIdx: index("exec_trigger_id_idx").on(table.triggerId),
196
- execWorkflowIdIdx: index("exec_workflow_id_idx").on(table.workflowId),
197
  };
198
  });
199
 
 
38
  emailStatus: varchar("email_status", { length: 20 }),
39
  createdAt: timestamp("created_at").defaultNow().notNull(),
40
  updatedAt: timestamp("updated_at").defaultNow().notNull(),
41
+ }, (table) => {
42
+ return {
43
+ userIdIdx: index("businesses_user_idx").on(table.userId),
44
+ emailIdx: index("businesses_email_idx").on(table.email),
45
+ emailStatusIdx: index("businesses_email_status_idx").on(table.emailStatus),
46
+ createdAtIdx: index("businesses_created_at_idx").on(table.createdAt),
47
+ userStatusIdx: index("businesses_user_status_idx").on(table.userId, table.emailStatus),
48
+ };
49
  });
50
 
51
  export const emailTemplates = pgTable("email_templates", {
 
57
  isDefault: boolean("is_default").default(false).notNull(),
58
  createdAt: timestamp("created_at").defaultNow().notNull(),
59
  updatedAt: timestamp("updated_at").defaultNow().notNull(),
60
+ }, (table) => {
61
+ return {
62
+ userIdIdx: index("email_templates_user_idx").on(table.userId),
63
+ isDefaultIdx: index("email_templates_default_idx").on(table.isDefault),
64
+ };
65
  });
66
 
67
  export const automationWorkflows = pgTable("automation_workflows", {
 
102
  openedAt: timestamp("opened_at"),
103
  clickedAt: timestamp("clicked_at"),
104
  createdAt: timestamp("created_at").defaultNow().notNull(),
105
+ }, (table) => {
106
+ return {
107
+ businessIdIdx: index("email_logs_business_idx").on(table.businessId),
108
+ statusIdx: index("email_logs_status_idx").on(table.status),
109
+ sentAtIdx: index("email_logs_sent_at_idx").on(table.sentAt),
110
+ businessStatusIdx: index("email_logs_business_status_idx").on(table.businessId, table.status),
111
+ };
112
  });
113
 
114
  export const scrapingJobs = pgTable("scraping_jobs", {
 
213
  }, (table) => {
214
  return {
215
  execTriggerIdIdx: index("exec_trigger_id_idx").on(table.triggerId),
216
+ triggerExecWorkflowIdIdx: index("trigger_exec_workflow_id_idx").on(table.workflowId),
217
  };
218
  });
219
 
drizzle/0002_lush_luckman.sql ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CREATE TABLE "connected_accounts" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "user_id" text NOT NULL,
4
+ "provider" varchar(50) NOT NULL,
5
+ "provider_account_id" text NOT NULL,
6
+ "access_token" text NOT NULL,
7
+ "refresh_token" text,
8
+ "expires_at" timestamp,
9
+ "name" text,
10
+ "picture" text,
11
+ "metadata" jsonb,
12
+ "created_at" timestamp DEFAULT now() NOT NULL,
13
+ "updated_at" timestamp DEFAULT now() NOT NULL
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE TABLE "social_automations" (
17
+ "id" text PRIMARY KEY NOT NULL,
18
+ "user_id" text NOT NULL,
19
+ "connected_account_id" text,
20
+ "name" text NOT NULL,
21
+ "trigger_type" varchar(50) NOT NULL,
22
+ "keywords" jsonb,
23
+ "action_type" varchar(50) NOT NULL,
24
+ "response_template" text,
25
+ "is_active" boolean DEFAULT true NOT NULL,
26
+ "created_at" timestamp DEFAULT now() NOT NULL,
27
+ "updated_at" timestamp DEFAULT now() NOT NULL
28
+ );
29
+ --> statement-breakpoint
30
+ CREATE TABLE "social_posts" (
31
+ "id" text PRIMARY KEY NOT NULL,
32
+ "user_id" text NOT NULL,
33
+ "connected_account_id" text,
34
+ "content" text,
35
+ "media_urls" jsonb,
36
+ "scheduled_at" timestamp,
37
+ "status" varchar(20) DEFAULT 'draft' NOT NULL,
38
+ "platform" varchar(20) NOT NULL,
39
+ "published_at" timestamp,
40
+ "platform_post_id" text,
41
+ "error" text,
42
+ "created_at" timestamp DEFAULT now() NOT NULL,
43
+ "updated_at" timestamp DEFAULT now() NOT NULL
44
+ );
45
+ --> statement-breakpoint
46
+ CREATE TABLE "whatsapp_messages" (
47
+ "id" text PRIMARY KEY NOT NULL,
48
+ "wamid" text,
49
+ "phone_number" text NOT NULL,
50
+ "direction" varchar(10) NOT NULL,
51
+ "type" varchar(20) DEFAULT 'text',
52
+ "status" varchar(20) DEFAULT 'sent',
53
+ "body" text,
54
+ "created_at" timestamp DEFAULT now() NOT NULL,
55
+ "updated_at" timestamp DEFAULT now() NOT NULL,
56
+ CONSTRAINT "whatsapp_messages_wamid_unique" UNIQUE("wamid")
57
+ );
58
+ --> statement-breakpoint
59
+ ALTER TABLE "automation_workflows" ADD COLUMN "description" text;--> statement-breakpoint
60
+ ALTER TABLE "automation_workflows" ADD COLUMN "last_run_at" timestamp;--> statement-breakpoint
61
+ ALTER TABLE "automation_workflows" ADD COLUMN "execution_count" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
62
+ ALTER TABLE "automation_workflows" ADD COLUMN "timezone" varchar(50) DEFAULT 'UTC' NOT NULL;--> statement-breakpoint
63
+ ALTER TABLE "users" ADD COLUMN "linkedin_session_cookie" text;--> statement-breakpoint
64
+ ALTER TABLE "workflow_execution_logs" ADD COLUMN "state" jsonb;--> statement-breakpoint
65
+ ALTER TABLE "workflow_execution_logs" ADD COLUMN "metadata" jsonb;--> statement-breakpoint
66
+ ALTER TABLE "connected_accounts" ADD CONSTRAINT "connected_accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
67
+ ALTER TABLE "social_automations" ADD CONSTRAINT "social_automations_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
68
+ ALTER TABLE "social_automations" ADD CONSTRAINT "social_automations_connected_account_id_connected_accounts_id_fk" FOREIGN KEY ("connected_account_id") REFERENCES "public"."connected_accounts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
69
+ ALTER TABLE "social_posts" ADD CONSTRAINT "social_posts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
70
+ ALTER TABLE "social_posts" ADD CONSTRAINT "social_posts_connected_account_id_connected_accounts_id_fk" FOREIGN KEY ("connected_account_id") REFERENCES "public"."connected_accounts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
71
+ CREATE INDEX "workflow_user_id_idx" ON "automation_workflows" USING btree ("user_id");--> statement-breakpoint
72
+ CREATE INDEX "workflow_is_active_idx" ON "automation_workflows" USING btree ("is_active");--> statement-breakpoint
73
+ CREATE INDEX "exec_workflow_id_idx" ON "workflow_execution_logs" USING btree ("workflow_id");--> statement-breakpoint
74
+ CREATE INDEX "exec_started_at_idx" ON "workflow_execution_logs" USING btree ("started_at");--> statement-breakpoint
75
+ CREATE INDEX "exec_trigger_id_idx" ON "workflow_trigger_executions" USING btree ("trigger_id");--> statement-breakpoint
76
+ CREATE INDEX "trigger_exec_workflow_id_idx" ON "workflow_trigger_executions" USING btree ("workflow_id");
drizzle/0003_flaky_landau.sql ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CREATE INDEX "businesses_user_idx" ON "businesses" USING btree ("user_id");--> statement-breakpoint
2
+ CREATE INDEX "businesses_email_idx" ON "businesses" USING btree ("email");--> statement-breakpoint
3
+ CREATE INDEX "businesses_email_status_idx" ON "businesses" USING btree ("email_status");--> statement-breakpoint
4
+ CREATE INDEX "businesses_created_at_idx" ON "businesses" USING btree ("created_at");--> statement-breakpoint
5
+ CREATE INDEX "businesses_user_status_idx" ON "businesses" USING btree ("user_id","email_status");--> statement-breakpoint
6
+ CREATE INDEX "email_logs_business_idx" ON "email_logs" USING btree ("business_id");--> statement-breakpoint
7
+ CREATE INDEX "email_logs_status_idx" ON "email_logs" USING btree ("status");--> statement-breakpoint
8
+ CREATE INDEX "email_logs_sent_at_idx" ON "email_logs" USING btree ("sent_at");--> statement-breakpoint
9
+ CREATE INDEX "email_logs_business_status_idx" ON "email_logs" USING btree ("business_id","status");--> statement-breakpoint
10
+ CREATE INDEX "email_templates_user_idx" ON "email_templates" USING btree ("user_id");--> statement-breakpoint
11
+ CREATE INDEX "email_templates_default_idx" ON "email_templates" USING btree ("is_default");
drizzle/meta/0002_snapshot.json ADDED
@@ -0,0 +1,1744 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "2511f2ca-8d69-4f1c-ba25-aa1ea9a5366c",
3
+ "prevId": "5f850c72-a6d0-4f71-b278-29f2c37271bb",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.automation_workflows": {
8
+ "name": "automation_workflows",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "user_id": {
18
+ "name": "user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "name": {
24
+ "name": "name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "description": {
30
+ "name": "description",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "target_business_type": {
36
+ "name": "target_business_type",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "keywords": {
42
+ "name": "keywords",
43
+ "type": "jsonb",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "is_active": {
48
+ "name": "is_active",
49
+ "type": "boolean",
50
+ "primaryKey": false,
51
+ "notNull": true,
52
+ "default": false
53
+ },
54
+ "priority": {
55
+ "name": "priority",
56
+ "type": "varchar(10)",
57
+ "primaryKey": false,
58
+ "notNull": true,
59
+ "default": "'high'"
60
+ },
61
+ "nodes": {
62
+ "name": "nodes",
63
+ "type": "jsonb",
64
+ "primaryKey": false,
65
+ "notNull": true
66
+ },
67
+ "edges": {
68
+ "name": "edges",
69
+ "type": "jsonb",
70
+ "primaryKey": false,
71
+ "notNull": true
72
+ },
73
+ "last_run_at": {
74
+ "name": "last_run_at",
75
+ "type": "timestamp",
76
+ "primaryKey": false,
77
+ "notNull": false
78
+ },
79
+ "execution_count": {
80
+ "name": "execution_count",
81
+ "type": "integer",
82
+ "primaryKey": false,
83
+ "notNull": true,
84
+ "default": 0
85
+ },
86
+ "timezone": {
87
+ "name": "timezone",
88
+ "type": "varchar(50)",
89
+ "primaryKey": false,
90
+ "notNull": true,
91
+ "default": "'UTC'"
92
+ },
93
+ "created_at": {
94
+ "name": "created_at",
95
+ "type": "timestamp",
96
+ "primaryKey": false,
97
+ "notNull": true,
98
+ "default": "now()"
99
+ },
100
+ "updated_at": {
101
+ "name": "updated_at",
102
+ "type": "timestamp",
103
+ "primaryKey": false,
104
+ "notNull": true,
105
+ "default": "now()"
106
+ }
107
+ },
108
+ "indexes": {
109
+ "workflow_user_id_idx": {
110
+ "name": "workflow_user_id_idx",
111
+ "columns": [
112
+ {
113
+ "expression": "user_id",
114
+ "isExpression": false,
115
+ "asc": true,
116
+ "nulls": "last"
117
+ }
118
+ ],
119
+ "isUnique": false,
120
+ "concurrently": false,
121
+ "method": "btree",
122
+ "with": {}
123
+ },
124
+ "workflow_is_active_idx": {
125
+ "name": "workflow_is_active_idx",
126
+ "columns": [
127
+ {
128
+ "expression": "is_active",
129
+ "isExpression": false,
130
+ "asc": true,
131
+ "nulls": "last"
132
+ }
133
+ ],
134
+ "isUnique": false,
135
+ "concurrently": false,
136
+ "method": "btree",
137
+ "with": {}
138
+ }
139
+ },
140
+ "foreignKeys": {
141
+ "automation_workflows_user_id_users_id_fk": {
142
+ "name": "automation_workflows_user_id_users_id_fk",
143
+ "tableFrom": "automation_workflows",
144
+ "tableTo": "users",
145
+ "columnsFrom": [
146
+ "user_id"
147
+ ],
148
+ "columnsTo": [
149
+ "id"
150
+ ],
151
+ "onDelete": "cascade",
152
+ "onUpdate": "no action"
153
+ }
154
+ },
155
+ "compositePrimaryKeys": {},
156
+ "uniqueConstraints": {},
157
+ "policies": {},
158
+ "checkConstraints": {},
159
+ "isRLSEnabled": false
160
+ },
161
+ "public.banners": {
162
+ "name": "banners",
163
+ "schema": "",
164
+ "columns": {
165
+ "id": {
166
+ "name": "id",
167
+ "type": "text",
168
+ "primaryKey": true,
169
+ "notNull": true
170
+ },
171
+ "message": {
172
+ "name": "message",
173
+ "type": "text",
174
+ "primaryKey": false,
175
+ "notNull": true
176
+ },
177
+ "is_active": {
178
+ "name": "is_active",
179
+ "type": "boolean",
180
+ "primaryKey": false,
181
+ "notNull": true,
182
+ "default": true
183
+ },
184
+ "created_at": {
185
+ "name": "created_at",
186
+ "type": "timestamp",
187
+ "primaryKey": false,
188
+ "notNull": true,
189
+ "default": "now()"
190
+ },
191
+ "created_by": {
192
+ "name": "created_by",
193
+ "type": "text",
194
+ "primaryKey": false,
195
+ "notNull": false
196
+ }
197
+ },
198
+ "indexes": {},
199
+ "foreignKeys": {
200
+ "banners_created_by_users_id_fk": {
201
+ "name": "banners_created_by_users_id_fk",
202
+ "tableFrom": "banners",
203
+ "tableTo": "users",
204
+ "columnsFrom": [
205
+ "created_by"
206
+ ],
207
+ "columnsTo": [
208
+ "id"
209
+ ],
210
+ "onDelete": "no action",
211
+ "onUpdate": "no action"
212
+ }
213
+ },
214
+ "compositePrimaryKeys": {},
215
+ "uniqueConstraints": {},
216
+ "policies": {},
217
+ "checkConstraints": {},
218
+ "isRLSEnabled": false
219
+ },
220
+ "public.businesses": {
221
+ "name": "businesses",
222
+ "schema": "",
223
+ "columns": {
224
+ "id": {
225
+ "name": "id",
226
+ "type": "text",
227
+ "primaryKey": true,
228
+ "notNull": true
229
+ },
230
+ "user_id": {
231
+ "name": "user_id",
232
+ "type": "text",
233
+ "primaryKey": false,
234
+ "notNull": true
235
+ },
236
+ "name": {
237
+ "name": "name",
238
+ "type": "text",
239
+ "primaryKey": false,
240
+ "notNull": true
241
+ },
242
+ "email": {
243
+ "name": "email",
244
+ "type": "text",
245
+ "primaryKey": false,
246
+ "notNull": false
247
+ },
248
+ "phone": {
249
+ "name": "phone",
250
+ "type": "text",
251
+ "primaryKey": false,
252
+ "notNull": false
253
+ },
254
+ "website": {
255
+ "name": "website",
256
+ "type": "text",
257
+ "primaryKey": false,
258
+ "notNull": false
259
+ },
260
+ "address": {
261
+ "name": "address",
262
+ "type": "text",
263
+ "primaryKey": false,
264
+ "notNull": false
265
+ },
266
+ "category": {
267
+ "name": "category",
268
+ "type": "text",
269
+ "primaryKey": false,
270
+ "notNull": true
271
+ },
272
+ "rating": {
273
+ "name": "rating",
274
+ "type": "real",
275
+ "primaryKey": false,
276
+ "notNull": false
277
+ },
278
+ "review_count": {
279
+ "name": "review_count",
280
+ "type": "integer",
281
+ "primaryKey": false,
282
+ "notNull": false
283
+ },
284
+ "latitude": {
285
+ "name": "latitude",
286
+ "type": "real",
287
+ "primaryKey": false,
288
+ "notNull": false
289
+ },
290
+ "longitude": {
291
+ "name": "longitude",
292
+ "type": "real",
293
+ "primaryKey": false,
294
+ "notNull": false
295
+ },
296
+ "email_sent": {
297
+ "name": "email_sent",
298
+ "type": "boolean",
299
+ "primaryKey": false,
300
+ "notNull": true,
301
+ "default": false
302
+ },
303
+ "email_sent_at": {
304
+ "name": "email_sent_at",
305
+ "type": "timestamp",
306
+ "primaryKey": false,
307
+ "notNull": false
308
+ },
309
+ "email_status": {
310
+ "name": "email_status",
311
+ "type": "varchar(20)",
312
+ "primaryKey": false,
313
+ "notNull": false
314
+ },
315
+ "created_at": {
316
+ "name": "created_at",
317
+ "type": "timestamp",
318
+ "primaryKey": false,
319
+ "notNull": true,
320
+ "default": "now()"
321
+ },
322
+ "updated_at": {
323
+ "name": "updated_at",
324
+ "type": "timestamp",
325
+ "primaryKey": false,
326
+ "notNull": true,
327
+ "default": "now()"
328
+ }
329
+ },
330
+ "indexes": {},
331
+ "foreignKeys": {
332
+ "businesses_user_id_users_id_fk": {
333
+ "name": "businesses_user_id_users_id_fk",
334
+ "tableFrom": "businesses",
335
+ "tableTo": "users",
336
+ "columnsFrom": [
337
+ "user_id"
338
+ ],
339
+ "columnsTo": [
340
+ "id"
341
+ ],
342
+ "onDelete": "cascade",
343
+ "onUpdate": "no action"
344
+ }
345
+ },
346
+ "compositePrimaryKeys": {},
347
+ "uniqueConstraints": {},
348
+ "policies": {},
349
+ "checkConstraints": {},
350
+ "isRLSEnabled": false
351
+ },
352
+ "public.connected_accounts": {
353
+ "name": "connected_accounts",
354
+ "schema": "",
355
+ "columns": {
356
+ "id": {
357
+ "name": "id",
358
+ "type": "text",
359
+ "primaryKey": true,
360
+ "notNull": true
361
+ },
362
+ "user_id": {
363
+ "name": "user_id",
364
+ "type": "text",
365
+ "primaryKey": false,
366
+ "notNull": true
367
+ },
368
+ "provider": {
369
+ "name": "provider",
370
+ "type": "varchar(50)",
371
+ "primaryKey": false,
372
+ "notNull": true
373
+ },
374
+ "provider_account_id": {
375
+ "name": "provider_account_id",
376
+ "type": "text",
377
+ "primaryKey": false,
378
+ "notNull": true
379
+ },
380
+ "access_token": {
381
+ "name": "access_token",
382
+ "type": "text",
383
+ "primaryKey": false,
384
+ "notNull": true
385
+ },
386
+ "refresh_token": {
387
+ "name": "refresh_token",
388
+ "type": "text",
389
+ "primaryKey": false,
390
+ "notNull": false
391
+ },
392
+ "expires_at": {
393
+ "name": "expires_at",
394
+ "type": "timestamp",
395
+ "primaryKey": false,
396
+ "notNull": false
397
+ },
398
+ "name": {
399
+ "name": "name",
400
+ "type": "text",
401
+ "primaryKey": false,
402
+ "notNull": false
403
+ },
404
+ "picture": {
405
+ "name": "picture",
406
+ "type": "text",
407
+ "primaryKey": false,
408
+ "notNull": false
409
+ },
410
+ "metadata": {
411
+ "name": "metadata",
412
+ "type": "jsonb",
413
+ "primaryKey": false,
414
+ "notNull": false
415
+ },
416
+ "created_at": {
417
+ "name": "created_at",
418
+ "type": "timestamp",
419
+ "primaryKey": false,
420
+ "notNull": true,
421
+ "default": "now()"
422
+ },
423
+ "updated_at": {
424
+ "name": "updated_at",
425
+ "type": "timestamp",
426
+ "primaryKey": false,
427
+ "notNull": true,
428
+ "default": "now()"
429
+ }
430
+ },
431
+ "indexes": {},
432
+ "foreignKeys": {
433
+ "connected_accounts_user_id_users_id_fk": {
434
+ "name": "connected_accounts_user_id_users_id_fk",
435
+ "tableFrom": "connected_accounts",
436
+ "tableTo": "users",
437
+ "columnsFrom": [
438
+ "user_id"
439
+ ],
440
+ "columnsTo": [
441
+ "id"
442
+ ],
443
+ "onDelete": "cascade",
444
+ "onUpdate": "no action"
445
+ }
446
+ },
447
+ "compositePrimaryKeys": {},
448
+ "uniqueConstraints": {},
449
+ "policies": {},
450
+ "checkConstraints": {},
451
+ "isRLSEnabled": false
452
+ },
453
+ "public.email_logs": {
454
+ "name": "email_logs",
455
+ "schema": "",
456
+ "columns": {
457
+ "id": {
458
+ "name": "id",
459
+ "type": "text",
460
+ "primaryKey": true,
461
+ "notNull": true
462
+ },
463
+ "user_id": {
464
+ "name": "user_id",
465
+ "type": "text",
466
+ "primaryKey": false,
467
+ "notNull": true
468
+ },
469
+ "business_id": {
470
+ "name": "business_id",
471
+ "type": "text",
472
+ "primaryKey": false,
473
+ "notNull": true
474
+ },
475
+ "template_id": {
476
+ "name": "template_id",
477
+ "type": "text",
478
+ "primaryKey": false,
479
+ "notNull": true
480
+ },
481
+ "subject": {
482
+ "name": "subject",
483
+ "type": "text",
484
+ "primaryKey": false,
485
+ "notNull": true
486
+ },
487
+ "body": {
488
+ "name": "body",
489
+ "type": "text",
490
+ "primaryKey": false,
491
+ "notNull": true
492
+ },
493
+ "status": {
494
+ "name": "status",
495
+ "type": "varchar(20)",
496
+ "primaryKey": false,
497
+ "notNull": true
498
+ },
499
+ "error_message": {
500
+ "name": "error_message",
501
+ "type": "text",
502
+ "primaryKey": false,
503
+ "notNull": false
504
+ },
505
+ "sent_at": {
506
+ "name": "sent_at",
507
+ "type": "timestamp",
508
+ "primaryKey": false,
509
+ "notNull": false
510
+ },
511
+ "opened_at": {
512
+ "name": "opened_at",
513
+ "type": "timestamp",
514
+ "primaryKey": false,
515
+ "notNull": false
516
+ },
517
+ "clicked_at": {
518
+ "name": "clicked_at",
519
+ "type": "timestamp",
520
+ "primaryKey": false,
521
+ "notNull": false
522
+ },
523
+ "created_at": {
524
+ "name": "created_at",
525
+ "type": "timestamp",
526
+ "primaryKey": false,
527
+ "notNull": true,
528
+ "default": "now()"
529
+ }
530
+ },
531
+ "indexes": {},
532
+ "foreignKeys": {
533
+ "email_logs_user_id_users_id_fk": {
534
+ "name": "email_logs_user_id_users_id_fk",
535
+ "tableFrom": "email_logs",
536
+ "tableTo": "users",
537
+ "columnsFrom": [
538
+ "user_id"
539
+ ],
540
+ "columnsTo": [
541
+ "id"
542
+ ],
543
+ "onDelete": "cascade",
544
+ "onUpdate": "no action"
545
+ },
546
+ "email_logs_business_id_businesses_id_fk": {
547
+ "name": "email_logs_business_id_businesses_id_fk",
548
+ "tableFrom": "email_logs",
549
+ "tableTo": "businesses",
550
+ "columnsFrom": [
551
+ "business_id"
552
+ ],
553
+ "columnsTo": [
554
+ "id"
555
+ ],
556
+ "onDelete": "cascade",
557
+ "onUpdate": "no action"
558
+ },
559
+ "email_logs_template_id_email_templates_id_fk": {
560
+ "name": "email_logs_template_id_email_templates_id_fk",
561
+ "tableFrom": "email_logs",
562
+ "tableTo": "email_templates",
563
+ "columnsFrom": [
564
+ "template_id"
565
+ ],
566
+ "columnsTo": [
567
+ "id"
568
+ ],
569
+ "onDelete": "no action",
570
+ "onUpdate": "no action"
571
+ }
572
+ },
573
+ "compositePrimaryKeys": {},
574
+ "uniqueConstraints": {},
575
+ "policies": {},
576
+ "checkConstraints": {},
577
+ "isRLSEnabled": false
578
+ },
579
+ "public.email_templates": {
580
+ "name": "email_templates",
581
+ "schema": "",
582
+ "columns": {
583
+ "id": {
584
+ "name": "id",
585
+ "type": "text",
586
+ "primaryKey": true,
587
+ "notNull": true
588
+ },
589
+ "user_id": {
590
+ "name": "user_id",
591
+ "type": "text",
592
+ "primaryKey": false,
593
+ "notNull": true
594
+ },
595
+ "name": {
596
+ "name": "name",
597
+ "type": "text",
598
+ "primaryKey": false,
599
+ "notNull": true
600
+ },
601
+ "subject": {
602
+ "name": "subject",
603
+ "type": "text",
604
+ "primaryKey": false,
605
+ "notNull": true
606
+ },
607
+ "body": {
608
+ "name": "body",
609
+ "type": "text",
610
+ "primaryKey": false,
611
+ "notNull": true
612
+ },
613
+ "is_default": {
614
+ "name": "is_default",
615
+ "type": "boolean",
616
+ "primaryKey": false,
617
+ "notNull": true,
618
+ "default": false
619
+ },
620
+ "created_at": {
621
+ "name": "created_at",
622
+ "type": "timestamp",
623
+ "primaryKey": false,
624
+ "notNull": true,
625
+ "default": "now()"
626
+ },
627
+ "updated_at": {
628
+ "name": "updated_at",
629
+ "type": "timestamp",
630
+ "primaryKey": false,
631
+ "notNull": true,
632
+ "default": "now()"
633
+ }
634
+ },
635
+ "indexes": {},
636
+ "foreignKeys": {
637
+ "email_templates_user_id_users_id_fk": {
638
+ "name": "email_templates_user_id_users_id_fk",
639
+ "tableFrom": "email_templates",
640
+ "tableTo": "users",
641
+ "columnsFrom": [
642
+ "user_id"
643
+ ],
644
+ "columnsTo": [
645
+ "id"
646
+ ],
647
+ "onDelete": "cascade",
648
+ "onUpdate": "no action"
649
+ }
650
+ },
651
+ "compositePrimaryKeys": {},
652
+ "uniqueConstraints": {},
653
+ "policies": {},
654
+ "checkConstraints": {},
655
+ "isRLSEnabled": false
656
+ },
657
+ "public.feedback": {
658
+ "name": "feedback",
659
+ "schema": "",
660
+ "columns": {
661
+ "id": {
662
+ "name": "id",
663
+ "type": "text",
664
+ "primaryKey": true,
665
+ "notNull": true
666
+ },
667
+ "user_id": {
668
+ "name": "user_id",
669
+ "type": "text",
670
+ "primaryKey": false,
671
+ "notNull": false
672
+ },
673
+ "visitor_name": {
674
+ "name": "visitor_name",
675
+ "type": "text",
676
+ "primaryKey": false,
677
+ "notNull": false
678
+ },
679
+ "visitor_email": {
680
+ "name": "visitor_email",
681
+ "type": "text",
682
+ "primaryKey": false,
683
+ "notNull": false
684
+ },
685
+ "subject": {
686
+ "name": "subject",
687
+ "type": "text",
688
+ "primaryKey": false,
689
+ "notNull": false
690
+ },
691
+ "message": {
692
+ "name": "message",
693
+ "type": "text",
694
+ "primaryKey": false,
695
+ "notNull": true
696
+ },
697
+ "type": {
698
+ "name": "type",
699
+ "type": "varchar(20)",
700
+ "primaryKey": false,
701
+ "notNull": true,
702
+ "default": "'general'"
703
+ },
704
+ "status": {
705
+ "name": "status",
706
+ "type": "varchar(20)",
707
+ "primaryKey": false,
708
+ "notNull": true,
709
+ "default": "'new'"
710
+ },
711
+ "created_at": {
712
+ "name": "created_at",
713
+ "type": "timestamp",
714
+ "primaryKey": false,
715
+ "notNull": true,
716
+ "default": "now()"
717
+ }
718
+ },
719
+ "indexes": {},
720
+ "foreignKeys": {
721
+ "feedback_user_id_users_id_fk": {
722
+ "name": "feedback_user_id_users_id_fk",
723
+ "tableFrom": "feedback",
724
+ "tableTo": "users",
725
+ "columnsFrom": [
726
+ "user_id"
727
+ ],
728
+ "columnsTo": [
729
+ "id"
730
+ ],
731
+ "onDelete": "set null",
732
+ "onUpdate": "no action"
733
+ }
734
+ },
735
+ "compositePrimaryKeys": {},
736
+ "uniqueConstraints": {},
737
+ "policies": {},
738
+ "checkConstraints": {},
739
+ "isRLSEnabled": false
740
+ },
741
+ "public.notifications": {
742
+ "name": "notifications",
743
+ "schema": "",
744
+ "columns": {
745
+ "id": {
746
+ "name": "id",
747
+ "type": "text",
748
+ "primaryKey": true,
749
+ "notNull": true
750
+ },
751
+ "user_id": {
752
+ "name": "user_id",
753
+ "type": "text",
754
+ "primaryKey": false,
755
+ "notNull": false
756
+ },
757
+ "title": {
758
+ "name": "title",
759
+ "type": "text",
760
+ "primaryKey": false,
761
+ "notNull": true
762
+ },
763
+ "message": {
764
+ "name": "message",
765
+ "type": "text",
766
+ "primaryKey": false,
767
+ "notNull": true
768
+ },
769
+ "type": {
770
+ "name": "type",
771
+ "type": "varchar(20)",
772
+ "primaryKey": false,
773
+ "notNull": true,
774
+ "default": "'info'"
775
+ },
776
+ "read": {
777
+ "name": "read",
778
+ "type": "boolean",
779
+ "primaryKey": false,
780
+ "notNull": true,
781
+ "default": false
782
+ },
783
+ "created_at": {
784
+ "name": "created_at",
785
+ "type": "timestamp",
786
+ "primaryKey": false,
787
+ "notNull": true,
788
+ "default": "now()"
789
+ }
790
+ },
791
+ "indexes": {},
792
+ "foreignKeys": {
793
+ "notifications_user_id_users_id_fk": {
794
+ "name": "notifications_user_id_users_id_fk",
795
+ "tableFrom": "notifications",
796
+ "tableTo": "users",
797
+ "columnsFrom": [
798
+ "user_id"
799
+ ],
800
+ "columnsTo": [
801
+ "id"
802
+ ],
803
+ "onDelete": "cascade",
804
+ "onUpdate": "no action"
805
+ }
806
+ },
807
+ "compositePrimaryKeys": {},
808
+ "uniqueConstraints": {},
809
+ "policies": {},
810
+ "checkConstraints": {},
811
+ "isRLSEnabled": false
812
+ },
813
+ "public.scraping_jobs": {
814
+ "name": "scraping_jobs",
815
+ "schema": "",
816
+ "columns": {
817
+ "id": {
818
+ "name": "id",
819
+ "type": "text",
820
+ "primaryKey": true,
821
+ "notNull": true
822
+ },
823
+ "user_id": {
824
+ "name": "user_id",
825
+ "type": "text",
826
+ "primaryKey": false,
827
+ "notNull": true
828
+ },
829
+ "workflow_id": {
830
+ "name": "workflow_id",
831
+ "type": "text",
832
+ "primaryKey": false,
833
+ "notNull": false
834
+ },
835
+ "keywords": {
836
+ "name": "keywords",
837
+ "type": "jsonb",
838
+ "primaryKey": false,
839
+ "notNull": true
840
+ },
841
+ "status": {
842
+ "name": "status",
843
+ "type": "varchar(20)",
844
+ "primaryKey": false,
845
+ "notNull": true
846
+ },
847
+ "priority": {
848
+ "name": "priority",
849
+ "type": "varchar(10)",
850
+ "primaryKey": false,
851
+ "notNull": true,
852
+ "default": "'medium'"
853
+ },
854
+ "businesses_found": {
855
+ "name": "businesses_found",
856
+ "type": "integer",
857
+ "primaryKey": false,
858
+ "notNull": true,
859
+ "default": 0
860
+ },
861
+ "created_at": {
862
+ "name": "created_at",
863
+ "type": "timestamp",
864
+ "primaryKey": false,
865
+ "notNull": true,
866
+ "default": "now()"
867
+ },
868
+ "completed_at": {
869
+ "name": "completed_at",
870
+ "type": "timestamp",
871
+ "primaryKey": false,
872
+ "notNull": false
873
+ }
874
+ },
875
+ "indexes": {},
876
+ "foreignKeys": {
877
+ "scraping_jobs_user_id_users_id_fk": {
878
+ "name": "scraping_jobs_user_id_users_id_fk",
879
+ "tableFrom": "scraping_jobs",
880
+ "tableTo": "users",
881
+ "columnsFrom": [
882
+ "user_id"
883
+ ],
884
+ "columnsTo": [
885
+ "id"
886
+ ],
887
+ "onDelete": "cascade",
888
+ "onUpdate": "no action"
889
+ },
890
+ "scraping_jobs_workflow_id_automation_workflows_id_fk": {
891
+ "name": "scraping_jobs_workflow_id_automation_workflows_id_fk",
892
+ "tableFrom": "scraping_jobs",
893
+ "tableTo": "automation_workflows",
894
+ "columnsFrom": [
895
+ "workflow_id"
896
+ ],
897
+ "columnsTo": [
898
+ "id"
899
+ ],
900
+ "onDelete": "cascade",
901
+ "onUpdate": "no action"
902
+ }
903
+ },
904
+ "compositePrimaryKeys": {},
905
+ "uniqueConstraints": {},
906
+ "policies": {},
907
+ "checkConstraints": {},
908
+ "isRLSEnabled": false
909
+ },
910
+ "public.social_automations": {
911
+ "name": "social_automations",
912
+ "schema": "",
913
+ "columns": {
914
+ "id": {
915
+ "name": "id",
916
+ "type": "text",
917
+ "primaryKey": true,
918
+ "notNull": true
919
+ },
920
+ "user_id": {
921
+ "name": "user_id",
922
+ "type": "text",
923
+ "primaryKey": false,
924
+ "notNull": true
925
+ },
926
+ "connected_account_id": {
927
+ "name": "connected_account_id",
928
+ "type": "text",
929
+ "primaryKey": false,
930
+ "notNull": false
931
+ },
932
+ "name": {
933
+ "name": "name",
934
+ "type": "text",
935
+ "primaryKey": false,
936
+ "notNull": true
937
+ },
938
+ "trigger_type": {
939
+ "name": "trigger_type",
940
+ "type": "varchar(50)",
941
+ "primaryKey": false,
942
+ "notNull": true
943
+ },
944
+ "keywords": {
945
+ "name": "keywords",
946
+ "type": "jsonb",
947
+ "primaryKey": false,
948
+ "notNull": false
949
+ },
950
+ "action_type": {
951
+ "name": "action_type",
952
+ "type": "varchar(50)",
953
+ "primaryKey": false,
954
+ "notNull": true
955
+ },
956
+ "response_template": {
957
+ "name": "response_template",
958
+ "type": "text",
959
+ "primaryKey": false,
960
+ "notNull": false
961
+ },
962
+ "is_active": {
963
+ "name": "is_active",
964
+ "type": "boolean",
965
+ "primaryKey": false,
966
+ "notNull": true,
967
+ "default": true
968
+ },
969
+ "created_at": {
970
+ "name": "created_at",
971
+ "type": "timestamp",
972
+ "primaryKey": false,
973
+ "notNull": true,
974
+ "default": "now()"
975
+ },
976
+ "updated_at": {
977
+ "name": "updated_at",
978
+ "type": "timestamp",
979
+ "primaryKey": false,
980
+ "notNull": true,
981
+ "default": "now()"
982
+ }
983
+ },
984
+ "indexes": {},
985
+ "foreignKeys": {
986
+ "social_automations_user_id_users_id_fk": {
987
+ "name": "social_automations_user_id_users_id_fk",
988
+ "tableFrom": "social_automations",
989
+ "tableTo": "users",
990
+ "columnsFrom": [
991
+ "user_id"
992
+ ],
993
+ "columnsTo": [
994
+ "id"
995
+ ],
996
+ "onDelete": "cascade",
997
+ "onUpdate": "no action"
998
+ },
999
+ "social_automations_connected_account_id_connected_accounts_id_fk": {
1000
+ "name": "social_automations_connected_account_id_connected_accounts_id_fk",
1001
+ "tableFrom": "social_automations",
1002
+ "tableTo": "connected_accounts",
1003
+ "columnsFrom": [
1004
+ "connected_account_id"
1005
+ ],
1006
+ "columnsTo": [
1007
+ "id"
1008
+ ],
1009
+ "onDelete": "cascade",
1010
+ "onUpdate": "no action"
1011
+ }
1012
+ },
1013
+ "compositePrimaryKeys": {},
1014
+ "uniqueConstraints": {},
1015
+ "policies": {},
1016
+ "checkConstraints": {},
1017
+ "isRLSEnabled": false
1018
+ },
1019
+ "public.social_posts": {
1020
+ "name": "social_posts",
1021
+ "schema": "",
1022
+ "columns": {
1023
+ "id": {
1024
+ "name": "id",
1025
+ "type": "text",
1026
+ "primaryKey": true,
1027
+ "notNull": true
1028
+ },
1029
+ "user_id": {
1030
+ "name": "user_id",
1031
+ "type": "text",
1032
+ "primaryKey": false,
1033
+ "notNull": true
1034
+ },
1035
+ "connected_account_id": {
1036
+ "name": "connected_account_id",
1037
+ "type": "text",
1038
+ "primaryKey": false,
1039
+ "notNull": false
1040
+ },
1041
+ "content": {
1042
+ "name": "content",
1043
+ "type": "text",
1044
+ "primaryKey": false,
1045
+ "notNull": false
1046
+ },
1047
+ "media_urls": {
1048
+ "name": "media_urls",
1049
+ "type": "jsonb",
1050
+ "primaryKey": false,
1051
+ "notNull": false
1052
+ },
1053
+ "scheduled_at": {
1054
+ "name": "scheduled_at",
1055
+ "type": "timestamp",
1056
+ "primaryKey": false,
1057
+ "notNull": false
1058
+ },
1059
+ "status": {
1060
+ "name": "status",
1061
+ "type": "varchar(20)",
1062
+ "primaryKey": false,
1063
+ "notNull": true,
1064
+ "default": "'draft'"
1065
+ },
1066
+ "platform": {
1067
+ "name": "platform",
1068
+ "type": "varchar(20)",
1069
+ "primaryKey": false,
1070
+ "notNull": true
1071
+ },
1072
+ "published_at": {
1073
+ "name": "published_at",
1074
+ "type": "timestamp",
1075
+ "primaryKey": false,
1076
+ "notNull": false
1077
+ },
1078
+ "platform_post_id": {
1079
+ "name": "platform_post_id",
1080
+ "type": "text",
1081
+ "primaryKey": false,
1082
+ "notNull": false
1083
+ },
1084
+ "error": {
1085
+ "name": "error",
1086
+ "type": "text",
1087
+ "primaryKey": false,
1088
+ "notNull": false
1089
+ },
1090
+ "created_at": {
1091
+ "name": "created_at",
1092
+ "type": "timestamp",
1093
+ "primaryKey": false,
1094
+ "notNull": true,
1095
+ "default": "now()"
1096
+ },
1097
+ "updated_at": {
1098
+ "name": "updated_at",
1099
+ "type": "timestamp",
1100
+ "primaryKey": false,
1101
+ "notNull": true,
1102
+ "default": "now()"
1103
+ }
1104
+ },
1105
+ "indexes": {},
1106
+ "foreignKeys": {
1107
+ "social_posts_user_id_users_id_fk": {
1108
+ "name": "social_posts_user_id_users_id_fk",
1109
+ "tableFrom": "social_posts",
1110
+ "tableTo": "users",
1111
+ "columnsFrom": [
1112
+ "user_id"
1113
+ ],
1114
+ "columnsTo": [
1115
+ "id"
1116
+ ],
1117
+ "onDelete": "cascade",
1118
+ "onUpdate": "no action"
1119
+ },
1120
+ "social_posts_connected_account_id_connected_accounts_id_fk": {
1121
+ "name": "social_posts_connected_account_id_connected_accounts_id_fk",
1122
+ "tableFrom": "social_posts",
1123
+ "tableTo": "connected_accounts",
1124
+ "columnsFrom": [
1125
+ "connected_account_id"
1126
+ ],
1127
+ "columnsTo": [
1128
+ "id"
1129
+ ],
1130
+ "onDelete": "set null",
1131
+ "onUpdate": "no action"
1132
+ }
1133
+ },
1134
+ "compositePrimaryKeys": {},
1135
+ "uniqueConstraints": {},
1136
+ "policies": {},
1137
+ "checkConstraints": {},
1138
+ "isRLSEnabled": false
1139
+ },
1140
+ "public.users": {
1141
+ "name": "users",
1142
+ "schema": "",
1143
+ "columns": {
1144
+ "id": {
1145
+ "name": "id",
1146
+ "type": "text",
1147
+ "primaryKey": true,
1148
+ "notNull": true
1149
+ },
1150
+ "email": {
1151
+ "name": "email",
1152
+ "type": "text",
1153
+ "primaryKey": false,
1154
+ "notNull": true
1155
+ },
1156
+ "name": {
1157
+ "name": "name",
1158
+ "type": "text",
1159
+ "primaryKey": false,
1160
+ "notNull": false
1161
+ },
1162
+ "image": {
1163
+ "name": "image",
1164
+ "type": "text",
1165
+ "primaryKey": false,
1166
+ "notNull": false
1167
+ },
1168
+ "access_token": {
1169
+ "name": "access_token",
1170
+ "type": "text",
1171
+ "primaryKey": false,
1172
+ "notNull": false
1173
+ },
1174
+ "refresh_token": {
1175
+ "name": "refresh_token",
1176
+ "type": "text",
1177
+ "primaryKey": false,
1178
+ "notNull": false
1179
+ },
1180
+ "created_at": {
1181
+ "name": "created_at",
1182
+ "type": "timestamp",
1183
+ "primaryKey": false,
1184
+ "notNull": true,
1185
+ "default": "now()"
1186
+ },
1187
+ "updated_at": {
1188
+ "name": "updated_at",
1189
+ "type": "timestamp",
1190
+ "primaryKey": false,
1191
+ "notNull": true,
1192
+ "default": "now()"
1193
+ },
1194
+ "gemini_api_key": {
1195
+ "name": "gemini_api_key",
1196
+ "type": "text",
1197
+ "primaryKey": false,
1198
+ "notNull": false
1199
+ },
1200
+ "phone": {
1201
+ "name": "phone",
1202
+ "type": "text",
1203
+ "primaryKey": false,
1204
+ "notNull": false
1205
+ },
1206
+ "job_title": {
1207
+ "name": "job_title",
1208
+ "type": "text",
1209
+ "primaryKey": false,
1210
+ "notNull": false
1211
+ },
1212
+ "company": {
1213
+ "name": "company",
1214
+ "type": "text",
1215
+ "primaryKey": false,
1216
+ "notNull": false
1217
+ },
1218
+ "website": {
1219
+ "name": "website",
1220
+ "type": "text",
1221
+ "primaryKey": false,
1222
+ "notNull": false
1223
+ },
1224
+ "custom_variables": {
1225
+ "name": "custom_variables",
1226
+ "type": "jsonb",
1227
+ "primaryKey": false,
1228
+ "notNull": false
1229
+ },
1230
+ "linkedin_session_cookie": {
1231
+ "name": "linkedin_session_cookie",
1232
+ "type": "text",
1233
+ "primaryKey": false,
1234
+ "notNull": false
1235
+ }
1236
+ },
1237
+ "indexes": {},
1238
+ "foreignKeys": {},
1239
+ "compositePrimaryKeys": {},
1240
+ "uniqueConstraints": {
1241
+ "users_email_unique": {
1242
+ "name": "users_email_unique",
1243
+ "nullsNotDistinct": false,
1244
+ "columns": [
1245
+ "email"
1246
+ ]
1247
+ }
1248
+ },
1249
+ "policies": {},
1250
+ "checkConstraints": {},
1251
+ "isRLSEnabled": false
1252
+ },
1253
+ "public.whatsapp_messages": {
1254
+ "name": "whatsapp_messages",
1255
+ "schema": "",
1256
+ "columns": {
1257
+ "id": {
1258
+ "name": "id",
1259
+ "type": "text",
1260
+ "primaryKey": true,
1261
+ "notNull": true
1262
+ },
1263
+ "wamid": {
1264
+ "name": "wamid",
1265
+ "type": "text",
1266
+ "primaryKey": false,
1267
+ "notNull": false
1268
+ },
1269
+ "phone_number": {
1270
+ "name": "phone_number",
1271
+ "type": "text",
1272
+ "primaryKey": false,
1273
+ "notNull": true
1274
+ },
1275
+ "direction": {
1276
+ "name": "direction",
1277
+ "type": "varchar(10)",
1278
+ "primaryKey": false,
1279
+ "notNull": true
1280
+ },
1281
+ "type": {
1282
+ "name": "type",
1283
+ "type": "varchar(20)",
1284
+ "primaryKey": false,
1285
+ "notNull": false,
1286
+ "default": "'text'"
1287
+ },
1288
+ "status": {
1289
+ "name": "status",
1290
+ "type": "varchar(20)",
1291
+ "primaryKey": false,
1292
+ "notNull": false,
1293
+ "default": "'sent'"
1294
+ },
1295
+ "body": {
1296
+ "name": "body",
1297
+ "type": "text",
1298
+ "primaryKey": false,
1299
+ "notNull": false
1300
+ },
1301
+ "created_at": {
1302
+ "name": "created_at",
1303
+ "type": "timestamp",
1304
+ "primaryKey": false,
1305
+ "notNull": true,
1306
+ "default": "now()"
1307
+ },
1308
+ "updated_at": {
1309
+ "name": "updated_at",
1310
+ "type": "timestamp",
1311
+ "primaryKey": false,
1312
+ "notNull": true,
1313
+ "default": "now()"
1314
+ }
1315
+ },
1316
+ "indexes": {},
1317
+ "foreignKeys": {},
1318
+ "compositePrimaryKeys": {},
1319
+ "uniqueConstraints": {
1320
+ "whatsapp_messages_wamid_unique": {
1321
+ "name": "whatsapp_messages_wamid_unique",
1322
+ "nullsNotDistinct": false,
1323
+ "columns": [
1324
+ "wamid"
1325
+ ]
1326
+ }
1327
+ },
1328
+ "policies": {},
1329
+ "checkConstraints": {},
1330
+ "isRLSEnabled": false
1331
+ },
1332
+ "public.workflow_execution_logs": {
1333
+ "name": "workflow_execution_logs",
1334
+ "schema": "",
1335
+ "columns": {
1336
+ "id": {
1337
+ "name": "id",
1338
+ "type": "text",
1339
+ "primaryKey": true,
1340
+ "notNull": true
1341
+ },
1342
+ "workflow_id": {
1343
+ "name": "workflow_id",
1344
+ "type": "text",
1345
+ "primaryKey": false,
1346
+ "notNull": true
1347
+ },
1348
+ "business_id": {
1349
+ "name": "business_id",
1350
+ "type": "text",
1351
+ "primaryKey": false,
1352
+ "notNull": false
1353
+ },
1354
+ "user_id": {
1355
+ "name": "user_id",
1356
+ "type": "text",
1357
+ "primaryKey": false,
1358
+ "notNull": true
1359
+ },
1360
+ "status": {
1361
+ "name": "status",
1362
+ "type": "varchar(20)",
1363
+ "primaryKey": false,
1364
+ "notNull": true
1365
+ },
1366
+ "logs": {
1367
+ "name": "logs",
1368
+ "type": "text",
1369
+ "primaryKey": false,
1370
+ "notNull": false
1371
+ },
1372
+ "state": {
1373
+ "name": "state",
1374
+ "type": "jsonb",
1375
+ "primaryKey": false,
1376
+ "notNull": false
1377
+ },
1378
+ "error": {
1379
+ "name": "error",
1380
+ "type": "text",
1381
+ "primaryKey": false,
1382
+ "notNull": false
1383
+ },
1384
+ "started_at": {
1385
+ "name": "started_at",
1386
+ "type": "timestamp",
1387
+ "primaryKey": false,
1388
+ "notNull": false
1389
+ },
1390
+ "completed_at": {
1391
+ "name": "completed_at",
1392
+ "type": "timestamp",
1393
+ "primaryKey": false,
1394
+ "notNull": false
1395
+ },
1396
+ "created_at": {
1397
+ "name": "created_at",
1398
+ "type": "timestamp",
1399
+ "primaryKey": false,
1400
+ "notNull": true,
1401
+ "default": "now()"
1402
+ },
1403
+ "updated_at": {
1404
+ "name": "updated_at",
1405
+ "type": "timestamp",
1406
+ "primaryKey": false,
1407
+ "notNull": true,
1408
+ "default": "now()"
1409
+ },
1410
+ "metadata": {
1411
+ "name": "metadata",
1412
+ "type": "jsonb",
1413
+ "primaryKey": false,
1414
+ "notNull": false
1415
+ }
1416
+ },
1417
+ "indexes": {
1418
+ "exec_workflow_id_idx": {
1419
+ "name": "exec_workflow_id_idx",
1420
+ "columns": [
1421
+ {
1422
+ "expression": "workflow_id",
1423
+ "isExpression": false,
1424
+ "asc": true,
1425
+ "nulls": "last"
1426
+ }
1427
+ ],
1428
+ "isUnique": false,
1429
+ "concurrently": false,
1430
+ "method": "btree",
1431
+ "with": {}
1432
+ },
1433
+ "exec_started_at_idx": {
1434
+ "name": "exec_started_at_idx",
1435
+ "columns": [
1436
+ {
1437
+ "expression": "started_at",
1438
+ "isExpression": false,
1439
+ "asc": true,
1440
+ "nulls": "last"
1441
+ }
1442
+ ],
1443
+ "isUnique": false,
1444
+ "concurrently": false,
1445
+ "method": "btree",
1446
+ "with": {}
1447
+ }
1448
+ },
1449
+ "foreignKeys": {
1450
+ "workflow_execution_logs_workflow_id_automation_workflows_id_fk": {
1451
+ "name": "workflow_execution_logs_workflow_id_automation_workflows_id_fk",
1452
+ "tableFrom": "workflow_execution_logs",
1453
+ "tableTo": "automation_workflows",
1454
+ "columnsFrom": [
1455
+ "workflow_id"
1456
+ ],
1457
+ "columnsTo": [
1458
+ "id"
1459
+ ],
1460
+ "onDelete": "cascade",
1461
+ "onUpdate": "no action"
1462
+ },
1463
+ "workflow_execution_logs_business_id_businesses_id_fk": {
1464
+ "name": "workflow_execution_logs_business_id_businesses_id_fk",
1465
+ "tableFrom": "workflow_execution_logs",
1466
+ "tableTo": "businesses",
1467
+ "columnsFrom": [
1468
+ "business_id"
1469
+ ],
1470
+ "columnsTo": [
1471
+ "id"
1472
+ ],
1473
+ "onDelete": "set null",
1474
+ "onUpdate": "no action"
1475
+ },
1476
+ "workflow_execution_logs_user_id_users_id_fk": {
1477
+ "name": "workflow_execution_logs_user_id_users_id_fk",
1478
+ "tableFrom": "workflow_execution_logs",
1479
+ "tableTo": "users",
1480
+ "columnsFrom": [
1481
+ "user_id"
1482
+ ],
1483
+ "columnsTo": [
1484
+ "id"
1485
+ ],
1486
+ "onDelete": "cascade",
1487
+ "onUpdate": "no action"
1488
+ }
1489
+ },
1490
+ "compositePrimaryKeys": {},
1491
+ "uniqueConstraints": {},
1492
+ "policies": {},
1493
+ "checkConstraints": {},
1494
+ "isRLSEnabled": false
1495
+ },
1496
+ "public.workflow_trigger_executions": {
1497
+ "name": "workflow_trigger_executions",
1498
+ "schema": "",
1499
+ "columns": {
1500
+ "id": {
1501
+ "name": "id",
1502
+ "type": "text",
1503
+ "primaryKey": true,
1504
+ "notNull": true
1505
+ },
1506
+ "trigger_id": {
1507
+ "name": "trigger_id",
1508
+ "type": "text",
1509
+ "primaryKey": false,
1510
+ "notNull": true
1511
+ },
1512
+ "workflow_id": {
1513
+ "name": "workflow_id",
1514
+ "type": "text",
1515
+ "primaryKey": false,
1516
+ "notNull": true
1517
+ },
1518
+ "business_id": {
1519
+ "name": "business_id",
1520
+ "type": "text",
1521
+ "primaryKey": false,
1522
+ "notNull": false
1523
+ },
1524
+ "status": {
1525
+ "name": "status",
1526
+ "type": "varchar(20)",
1527
+ "primaryKey": false,
1528
+ "notNull": true
1529
+ },
1530
+ "error": {
1531
+ "name": "error",
1532
+ "type": "text",
1533
+ "primaryKey": false,
1534
+ "notNull": false
1535
+ },
1536
+ "executed_at": {
1537
+ "name": "executed_at",
1538
+ "type": "timestamp",
1539
+ "primaryKey": false,
1540
+ "notNull": false
1541
+ },
1542
+ "created_at": {
1543
+ "name": "created_at",
1544
+ "type": "timestamp",
1545
+ "primaryKey": false,
1546
+ "notNull": false,
1547
+ "default": "now()"
1548
+ }
1549
+ },
1550
+ "indexes": {
1551
+ "exec_trigger_id_idx": {
1552
+ "name": "exec_trigger_id_idx",
1553
+ "columns": [
1554
+ {
1555
+ "expression": "trigger_id",
1556
+ "isExpression": false,
1557
+ "asc": true,
1558
+ "nulls": "last"
1559
+ }
1560
+ ],
1561
+ "isUnique": false,
1562
+ "concurrently": false,
1563
+ "method": "btree",
1564
+ "with": {}
1565
+ },
1566
+ "trigger_exec_workflow_id_idx": {
1567
+ "name": "trigger_exec_workflow_id_idx",
1568
+ "columns": [
1569
+ {
1570
+ "expression": "workflow_id",
1571
+ "isExpression": false,
1572
+ "asc": true,
1573
+ "nulls": "last"
1574
+ }
1575
+ ],
1576
+ "isUnique": false,
1577
+ "concurrently": false,
1578
+ "method": "btree",
1579
+ "with": {}
1580
+ }
1581
+ },
1582
+ "foreignKeys": {
1583
+ "workflow_trigger_executions_trigger_id_workflow_triggers_id_fk": {
1584
+ "name": "workflow_trigger_executions_trigger_id_workflow_triggers_id_fk",
1585
+ "tableFrom": "workflow_trigger_executions",
1586
+ "tableTo": "workflow_triggers",
1587
+ "columnsFrom": [
1588
+ "trigger_id"
1589
+ ],
1590
+ "columnsTo": [
1591
+ "id"
1592
+ ],
1593
+ "onDelete": "cascade",
1594
+ "onUpdate": "no action"
1595
+ },
1596
+ "workflow_trigger_executions_workflow_id_automation_workflows_id_fk": {
1597
+ "name": "workflow_trigger_executions_workflow_id_automation_workflows_id_fk",
1598
+ "tableFrom": "workflow_trigger_executions",
1599
+ "tableTo": "automation_workflows",
1600
+ "columnsFrom": [
1601
+ "workflow_id"
1602
+ ],
1603
+ "columnsTo": [
1604
+ "id"
1605
+ ],
1606
+ "onDelete": "cascade",
1607
+ "onUpdate": "no action"
1608
+ },
1609
+ "workflow_trigger_executions_business_id_businesses_id_fk": {
1610
+ "name": "workflow_trigger_executions_business_id_businesses_id_fk",
1611
+ "tableFrom": "workflow_trigger_executions",
1612
+ "tableTo": "businesses",
1613
+ "columnsFrom": [
1614
+ "business_id"
1615
+ ],
1616
+ "columnsTo": [
1617
+ "id"
1618
+ ],
1619
+ "onDelete": "set null",
1620
+ "onUpdate": "no action"
1621
+ }
1622
+ },
1623
+ "compositePrimaryKeys": {},
1624
+ "uniqueConstraints": {},
1625
+ "policies": {},
1626
+ "checkConstraints": {},
1627
+ "isRLSEnabled": false
1628
+ },
1629
+ "public.workflow_triggers": {
1630
+ "name": "workflow_triggers",
1631
+ "schema": "",
1632
+ "columns": {
1633
+ "id": {
1634
+ "name": "id",
1635
+ "type": "text",
1636
+ "primaryKey": true,
1637
+ "notNull": true
1638
+ },
1639
+ "workflow_id": {
1640
+ "name": "workflow_id",
1641
+ "type": "text",
1642
+ "primaryKey": false,
1643
+ "notNull": true
1644
+ },
1645
+ "user_id": {
1646
+ "name": "user_id",
1647
+ "type": "text",
1648
+ "primaryKey": false,
1649
+ "notNull": true
1650
+ },
1651
+ "trigger_type": {
1652
+ "name": "trigger_type",
1653
+ "type": "varchar(50)",
1654
+ "primaryKey": false,
1655
+ "notNull": true
1656
+ },
1657
+ "config": {
1658
+ "name": "config",
1659
+ "type": "jsonb",
1660
+ "primaryKey": false,
1661
+ "notNull": false
1662
+ },
1663
+ "is_active": {
1664
+ "name": "is_active",
1665
+ "type": "boolean",
1666
+ "primaryKey": false,
1667
+ "notNull": false,
1668
+ "default": true
1669
+ },
1670
+ "last_run_at": {
1671
+ "name": "last_run_at",
1672
+ "type": "timestamp",
1673
+ "primaryKey": false,
1674
+ "notNull": false
1675
+ },
1676
+ "next_run_at": {
1677
+ "name": "next_run_at",
1678
+ "type": "timestamp",
1679
+ "primaryKey": false,
1680
+ "notNull": false
1681
+ },
1682
+ "created_at": {
1683
+ "name": "created_at",
1684
+ "type": "timestamp",
1685
+ "primaryKey": false,
1686
+ "notNull": false,
1687
+ "default": "now()"
1688
+ },
1689
+ "updated_at": {
1690
+ "name": "updated_at",
1691
+ "type": "timestamp",
1692
+ "primaryKey": false,
1693
+ "notNull": false,
1694
+ "default": "now()"
1695
+ }
1696
+ },
1697
+ "indexes": {},
1698
+ "foreignKeys": {
1699
+ "workflow_triggers_workflow_id_automation_workflows_id_fk": {
1700
+ "name": "workflow_triggers_workflow_id_automation_workflows_id_fk",
1701
+ "tableFrom": "workflow_triggers",
1702
+ "tableTo": "automation_workflows",
1703
+ "columnsFrom": [
1704
+ "workflow_id"
1705
+ ],
1706
+ "columnsTo": [
1707
+ "id"
1708
+ ],
1709
+ "onDelete": "cascade",
1710
+ "onUpdate": "no action"
1711
+ },
1712
+ "workflow_triggers_user_id_users_id_fk": {
1713
+ "name": "workflow_triggers_user_id_users_id_fk",
1714
+ "tableFrom": "workflow_triggers",
1715
+ "tableTo": "users",
1716
+ "columnsFrom": [
1717
+ "user_id"
1718
+ ],
1719
+ "columnsTo": [
1720
+ "id"
1721
+ ],
1722
+ "onDelete": "cascade",
1723
+ "onUpdate": "no action"
1724
+ }
1725
+ },
1726
+ "compositePrimaryKeys": {},
1727
+ "uniqueConstraints": {},
1728
+ "policies": {},
1729
+ "checkConstraints": {},
1730
+ "isRLSEnabled": false
1731
+ }
1732
+ },
1733
+ "enums": {},
1734
+ "schemas": {},
1735
+ "sequences": {},
1736
+ "roles": {},
1737
+ "policies": {},
1738
+ "views": {},
1739
+ "_meta": {
1740
+ "columns": {},
1741
+ "schemas": {},
1742
+ "tables": {}
1743
+ }
1744
+ }
drizzle/meta/0003_snapshot.json ADDED
@@ -0,0 +1,1924 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "5a9005e5-6f26-4c41-b789-00b3d7d31364",
3
+ "prevId": "2511f2ca-8d69-4f1c-ba25-aa1ea9a5366c",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.automation_workflows": {
8
+ "name": "automation_workflows",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "user_id": {
18
+ "name": "user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "name": {
24
+ "name": "name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "description": {
30
+ "name": "description",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "target_business_type": {
36
+ "name": "target_business_type",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "keywords": {
42
+ "name": "keywords",
43
+ "type": "jsonb",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "is_active": {
48
+ "name": "is_active",
49
+ "type": "boolean",
50
+ "primaryKey": false,
51
+ "notNull": true,
52
+ "default": false
53
+ },
54
+ "priority": {
55
+ "name": "priority",
56
+ "type": "varchar(10)",
57
+ "primaryKey": false,
58
+ "notNull": true,
59
+ "default": "'high'"
60
+ },
61
+ "nodes": {
62
+ "name": "nodes",
63
+ "type": "jsonb",
64
+ "primaryKey": false,
65
+ "notNull": true
66
+ },
67
+ "edges": {
68
+ "name": "edges",
69
+ "type": "jsonb",
70
+ "primaryKey": false,
71
+ "notNull": true
72
+ },
73
+ "last_run_at": {
74
+ "name": "last_run_at",
75
+ "type": "timestamp",
76
+ "primaryKey": false,
77
+ "notNull": false
78
+ },
79
+ "execution_count": {
80
+ "name": "execution_count",
81
+ "type": "integer",
82
+ "primaryKey": false,
83
+ "notNull": true,
84
+ "default": 0
85
+ },
86
+ "timezone": {
87
+ "name": "timezone",
88
+ "type": "varchar(50)",
89
+ "primaryKey": false,
90
+ "notNull": true,
91
+ "default": "'UTC'"
92
+ },
93
+ "created_at": {
94
+ "name": "created_at",
95
+ "type": "timestamp",
96
+ "primaryKey": false,
97
+ "notNull": true,
98
+ "default": "now()"
99
+ },
100
+ "updated_at": {
101
+ "name": "updated_at",
102
+ "type": "timestamp",
103
+ "primaryKey": false,
104
+ "notNull": true,
105
+ "default": "now()"
106
+ }
107
+ },
108
+ "indexes": {
109
+ "workflow_user_id_idx": {
110
+ "name": "workflow_user_id_idx",
111
+ "columns": [
112
+ {
113
+ "expression": "user_id",
114
+ "isExpression": false,
115
+ "asc": true,
116
+ "nulls": "last"
117
+ }
118
+ ],
119
+ "isUnique": false,
120
+ "concurrently": false,
121
+ "method": "btree",
122
+ "with": {}
123
+ },
124
+ "workflow_is_active_idx": {
125
+ "name": "workflow_is_active_idx",
126
+ "columns": [
127
+ {
128
+ "expression": "is_active",
129
+ "isExpression": false,
130
+ "asc": true,
131
+ "nulls": "last"
132
+ }
133
+ ],
134
+ "isUnique": false,
135
+ "concurrently": false,
136
+ "method": "btree",
137
+ "with": {}
138
+ }
139
+ },
140
+ "foreignKeys": {
141
+ "automation_workflows_user_id_users_id_fk": {
142
+ "name": "automation_workflows_user_id_users_id_fk",
143
+ "tableFrom": "automation_workflows",
144
+ "tableTo": "users",
145
+ "columnsFrom": [
146
+ "user_id"
147
+ ],
148
+ "columnsTo": [
149
+ "id"
150
+ ],
151
+ "onDelete": "cascade",
152
+ "onUpdate": "no action"
153
+ }
154
+ },
155
+ "compositePrimaryKeys": {},
156
+ "uniqueConstraints": {},
157
+ "policies": {},
158
+ "checkConstraints": {},
159
+ "isRLSEnabled": false
160
+ },
161
+ "public.banners": {
162
+ "name": "banners",
163
+ "schema": "",
164
+ "columns": {
165
+ "id": {
166
+ "name": "id",
167
+ "type": "text",
168
+ "primaryKey": true,
169
+ "notNull": true
170
+ },
171
+ "message": {
172
+ "name": "message",
173
+ "type": "text",
174
+ "primaryKey": false,
175
+ "notNull": true
176
+ },
177
+ "is_active": {
178
+ "name": "is_active",
179
+ "type": "boolean",
180
+ "primaryKey": false,
181
+ "notNull": true,
182
+ "default": true
183
+ },
184
+ "created_at": {
185
+ "name": "created_at",
186
+ "type": "timestamp",
187
+ "primaryKey": false,
188
+ "notNull": true,
189
+ "default": "now()"
190
+ },
191
+ "created_by": {
192
+ "name": "created_by",
193
+ "type": "text",
194
+ "primaryKey": false,
195
+ "notNull": false
196
+ }
197
+ },
198
+ "indexes": {},
199
+ "foreignKeys": {
200
+ "banners_created_by_users_id_fk": {
201
+ "name": "banners_created_by_users_id_fk",
202
+ "tableFrom": "banners",
203
+ "tableTo": "users",
204
+ "columnsFrom": [
205
+ "created_by"
206
+ ],
207
+ "columnsTo": [
208
+ "id"
209
+ ],
210
+ "onDelete": "no action",
211
+ "onUpdate": "no action"
212
+ }
213
+ },
214
+ "compositePrimaryKeys": {},
215
+ "uniqueConstraints": {},
216
+ "policies": {},
217
+ "checkConstraints": {},
218
+ "isRLSEnabled": false
219
+ },
220
+ "public.businesses": {
221
+ "name": "businesses",
222
+ "schema": "",
223
+ "columns": {
224
+ "id": {
225
+ "name": "id",
226
+ "type": "text",
227
+ "primaryKey": true,
228
+ "notNull": true
229
+ },
230
+ "user_id": {
231
+ "name": "user_id",
232
+ "type": "text",
233
+ "primaryKey": false,
234
+ "notNull": true
235
+ },
236
+ "name": {
237
+ "name": "name",
238
+ "type": "text",
239
+ "primaryKey": false,
240
+ "notNull": true
241
+ },
242
+ "email": {
243
+ "name": "email",
244
+ "type": "text",
245
+ "primaryKey": false,
246
+ "notNull": false
247
+ },
248
+ "phone": {
249
+ "name": "phone",
250
+ "type": "text",
251
+ "primaryKey": false,
252
+ "notNull": false
253
+ },
254
+ "website": {
255
+ "name": "website",
256
+ "type": "text",
257
+ "primaryKey": false,
258
+ "notNull": false
259
+ },
260
+ "address": {
261
+ "name": "address",
262
+ "type": "text",
263
+ "primaryKey": false,
264
+ "notNull": false
265
+ },
266
+ "category": {
267
+ "name": "category",
268
+ "type": "text",
269
+ "primaryKey": false,
270
+ "notNull": true
271
+ },
272
+ "rating": {
273
+ "name": "rating",
274
+ "type": "real",
275
+ "primaryKey": false,
276
+ "notNull": false
277
+ },
278
+ "review_count": {
279
+ "name": "review_count",
280
+ "type": "integer",
281
+ "primaryKey": false,
282
+ "notNull": false
283
+ },
284
+ "latitude": {
285
+ "name": "latitude",
286
+ "type": "real",
287
+ "primaryKey": false,
288
+ "notNull": false
289
+ },
290
+ "longitude": {
291
+ "name": "longitude",
292
+ "type": "real",
293
+ "primaryKey": false,
294
+ "notNull": false
295
+ },
296
+ "email_sent": {
297
+ "name": "email_sent",
298
+ "type": "boolean",
299
+ "primaryKey": false,
300
+ "notNull": true,
301
+ "default": false
302
+ },
303
+ "email_sent_at": {
304
+ "name": "email_sent_at",
305
+ "type": "timestamp",
306
+ "primaryKey": false,
307
+ "notNull": false
308
+ },
309
+ "email_status": {
310
+ "name": "email_status",
311
+ "type": "varchar(20)",
312
+ "primaryKey": false,
313
+ "notNull": false
314
+ },
315
+ "created_at": {
316
+ "name": "created_at",
317
+ "type": "timestamp",
318
+ "primaryKey": false,
319
+ "notNull": true,
320
+ "default": "now()"
321
+ },
322
+ "updated_at": {
323
+ "name": "updated_at",
324
+ "type": "timestamp",
325
+ "primaryKey": false,
326
+ "notNull": true,
327
+ "default": "now()"
328
+ }
329
+ },
330
+ "indexes": {
331
+ "businesses_user_idx": {
332
+ "name": "businesses_user_idx",
333
+ "columns": [
334
+ {
335
+ "expression": "user_id",
336
+ "isExpression": false,
337
+ "asc": true,
338
+ "nulls": "last"
339
+ }
340
+ ],
341
+ "isUnique": false,
342
+ "concurrently": false,
343
+ "method": "btree",
344
+ "with": {}
345
+ },
346
+ "businesses_email_idx": {
347
+ "name": "businesses_email_idx",
348
+ "columns": [
349
+ {
350
+ "expression": "email",
351
+ "isExpression": false,
352
+ "asc": true,
353
+ "nulls": "last"
354
+ }
355
+ ],
356
+ "isUnique": false,
357
+ "concurrently": false,
358
+ "method": "btree",
359
+ "with": {}
360
+ },
361
+ "businesses_email_status_idx": {
362
+ "name": "businesses_email_status_idx",
363
+ "columns": [
364
+ {
365
+ "expression": "email_status",
366
+ "isExpression": false,
367
+ "asc": true,
368
+ "nulls": "last"
369
+ }
370
+ ],
371
+ "isUnique": false,
372
+ "concurrently": false,
373
+ "method": "btree",
374
+ "with": {}
375
+ },
376
+ "businesses_created_at_idx": {
377
+ "name": "businesses_created_at_idx",
378
+ "columns": [
379
+ {
380
+ "expression": "created_at",
381
+ "isExpression": false,
382
+ "asc": true,
383
+ "nulls": "last"
384
+ }
385
+ ],
386
+ "isUnique": false,
387
+ "concurrently": false,
388
+ "method": "btree",
389
+ "with": {}
390
+ },
391
+ "businesses_user_status_idx": {
392
+ "name": "businesses_user_status_idx",
393
+ "columns": [
394
+ {
395
+ "expression": "user_id",
396
+ "isExpression": false,
397
+ "asc": true,
398
+ "nulls": "last"
399
+ },
400
+ {
401
+ "expression": "email_status",
402
+ "isExpression": false,
403
+ "asc": true,
404
+ "nulls": "last"
405
+ }
406
+ ],
407
+ "isUnique": false,
408
+ "concurrently": false,
409
+ "method": "btree",
410
+ "with": {}
411
+ }
412
+ },
413
+ "foreignKeys": {
414
+ "businesses_user_id_users_id_fk": {
415
+ "name": "businesses_user_id_users_id_fk",
416
+ "tableFrom": "businesses",
417
+ "tableTo": "users",
418
+ "columnsFrom": [
419
+ "user_id"
420
+ ],
421
+ "columnsTo": [
422
+ "id"
423
+ ],
424
+ "onDelete": "cascade",
425
+ "onUpdate": "no action"
426
+ }
427
+ },
428
+ "compositePrimaryKeys": {},
429
+ "uniqueConstraints": {},
430
+ "policies": {},
431
+ "checkConstraints": {},
432
+ "isRLSEnabled": false
433
+ },
434
+ "public.connected_accounts": {
435
+ "name": "connected_accounts",
436
+ "schema": "",
437
+ "columns": {
438
+ "id": {
439
+ "name": "id",
440
+ "type": "text",
441
+ "primaryKey": true,
442
+ "notNull": true
443
+ },
444
+ "user_id": {
445
+ "name": "user_id",
446
+ "type": "text",
447
+ "primaryKey": false,
448
+ "notNull": true
449
+ },
450
+ "provider": {
451
+ "name": "provider",
452
+ "type": "varchar(50)",
453
+ "primaryKey": false,
454
+ "notNull": true
455
+ },
456
+ "provider_account_id": {
457
+ "name": "provider_account_id",
458
+ "type": "text",
459
+ "primaryKey": false,
460
+ "notNull": true
461
+ },
462
+ "access_token": {
463
+ "name": "access_token",
464
+ "type": "text",
465
+ "primaryKey": false,
466
+ "notNull": true
467
+ },
468
+ "refresh_token": {
469
+ "name": "refresh_token",
470
+ "type": "text",
471
+ "primaryKey": false,
472
+ "notNull": false
473
+ },
474
+ "expires_at": {
475
+ "name": "expires_at",
476
+ "type": "timestamp",
477
+ "primaryKey": false,
478
+ "notNull": false
479
+ },
480
+ "name": {
481
+ "name": "name",
482
+ "type": "text",
483
+ "primaryKey": false,
484
+ "notNull": false
485
+ },
486
+ "picture": {
487
+ "name": "picture",
488
+ "type": "text",
489
+ "primaryKey": false,
490
+ "notNull": false
491
+ },
492
+ "metadata": {
493
+ "name": "metadata",
494
+ "type": "jsonb",
495
+ "primaryKey": false,
496
+ "notNull": false
497
+ },
498
+ "created_at": {
499
+ "name": "created_at",
500
+ "type": "timestamp",
501
+ "primaryKey": false,
502
+ "notNull": true,
503
+ "default": "now()"
504
+ },
505
+ "updated_at": {
506
+ "name": "updated_at",
507
+ "type": "timestamp",
508
+ "primaryKey": false,
509
+ "notNull": true,
510
+ "default": "now()"
511
+ }
512
+ },
513
+ "indexes": {},
514
+ "foreignKeys": {
515
+ "connected_accounts_user_id_users_id_fk": {
516
+ "name": "connected_accounts_user_id_users_id_fk",
517
+ "tableFrom": "connected_accounts",
518
+ "tableTo": "users",
519
+ "columnsFrom": [
520
+ "user_id"
521
+ ],
522
+ "columnsTo": [
523
+ "id"
524
+ ],
525
+ "onDelete": "cascade",
526
+ "onUpdate": "no action"
527
+ }
528
+ },
529
+ "compositePrimaryKeys": {},
530
+ "uniqueConstraints": {},
531
+ "policies": {},
532
+ "checkConstraints": {},
533
+ "isRLSEnabled": false
534
+ },
535
+ "public.email_logs": {
536
+ "name": "email_logs",
537
+ "schema": "",
538
+ "columns": {
539
+ "id": {
540
+ "name": "id",
541
+ "type": "text",
542
+ "primaryKey": true,
543
+ "notNull": true
544
+ },
545
+ "user_id": {
546
+ "name": "user_id",
547
+ "type": "text",
548
+ "primaryKey": false,
549
+ "notNull": true
550
+ },
551
+ "business_id": {
552
+ "name": "business_id",
553
+ "type": "text",
554
+ "primaryKey": false,
555
+ "notNull": true
556
+ },
557
+ "template_id": {
558
+ "name": "template_id",
559
+ "type": "text",
560
+ "primaryKey": false,
561
+ "notNull": true
562
+ },
563
+ "subject": {
564
+ "name": "subject",
565
+ "type": "text",
566
+ "primaryKey": false,
567
+ "notNull": true
568
+ },
569
+ "body": {
570
+ "name": "body",
571
+ "type": "text",
572
+ "primaryKey": false,
573
+ "notNull": true
574
+ },
575
+ "status": {
576
+ "name": "status",
577
+ "type": "varchar(20)",
578
+ "primaryKey": false,
579
+ "notNull": true
580
+ },
581
+ "error_message": {
582
+ "name": "error_message",
583
+ "type": "text",
584
+ "primaryKey": false,
585
+ "notNull": false
586
+ },
587
+ "sent_at": {
588
+ "name": "sent_at",
589
+ "type": "timestamp",
590
+ "primaryKey": false,
591
+ "notNull": false
592
+ },
593
+ "opened_at": {
594
+ "name": "opened_at",
595
+ "type": "timestamp",
596
+ "primaryKey": false,
597
+ "notNull": false
598
+ },
599
+ "clicked_at": {
600
+ "name": "clicked_at",
601
+ "type": "timestamp",
602
+ "primaryKey": false,
603
+ "notNull": false
604
+ },
605
+ "created_at": {
606
+ "name": "created_at",
607
+ "type": "timestamp",
608
+ "primaryKey": false,
609
+ "notNull": true,
610
+ "default": "now()"
611
+ }
612
+ },
613
+ "indexes": {
614
+ "email_logs_business_idx": {
615
+ "name": "email_logs_business_idx",
616
+ "columns": [
617
+ {
618
+ "expression": "business_id",
619
+ "isExpression": false,
620
+ "asc": true,
621
+ "nulls": "last"
622
+ }
623
+ ],
624
+ "isUnique": false,
625
+ "concurrently": false,
626
+ "method": "btree",
627
+ "with": {}
628
+ },
629
+ "email_logs_status_idx": {
630
+ "name": "email_logs_status_idx",
631
+ "columns": [
632
+ {
633
+ "expression": "status",
634
+ "isExpression": false,
635
+ "asc": true,
636
+ "nulls": "last"
637
+ }
638
+ ],
639
+ "isUnique": false,
640
+ "concurrently": false,
641
+ "method": "btree",
642
+ "with": {}
643
+ },
644
+ "email_logs_sent_at_idx": {
645
+ "name": "email_logs_sent_at_idx",
646
+ "columns": [
647
+ {
648
+ "expression": "sent_at",
649
+ "isExpression": false,
650
+ "asc": true,
651
+ "nulls": "last"
652
+ }
653
+ ],
654
+ "isUnique": false,
655
+ "concurrently": false,
656
+ "method": "btree",
657
+ "with": {}
658
+ },
659
+ "email_logs_business_status_idx": {
660
+ "name": "email_logs_business_status_idx",
661
+ "columns": [
662
+ {
663
+ "expression": "business_id",
664
+ "isExpression": false,
665
+ "asc": true,
666
+ "nulls": "last"
667
+ },
668
+ {
669
+ "expression": "status",
670
+ "isExpression": false,
671
+ "asc": true,
672
+ "nulls": "last"
673
+ }
674
+ ],
675
+ "isUnique": false,
676
+ "concurrently": false,
677
+ "method": "btree",
678
+ "with": {}
679
+ }
680
+ },
681
+ "foreignKeys": {
682
+ "email_logs_user_id_users_id_fk": {
683
+ "name": "email_logs_user_id_users_id_fk",
684
+ "tableFrom": "email_logs",
685
+ "tableTo": "users",
686
+ "columnsFrom": [
687
+ "user_id"
688
+ ],
689
+ "columnsTo": [
690
+ "id"
691
+ ],
692
+ "onDelete": "cascade",
693
+ "onUpdate": "no action"
694
+ },
695
+ "email_logs_business_id_businesses_id_fk": {
696
+ "name": "email_logs_business_id_businesses_id_fk",
697
+ "tableFrom": "email_logs",
698
+ "tableTo": "businesses",
699
+ "columnsFrom": [
700
+ "business_id"
701
+ ],
702
+ "columnsTo": [
703
+ "id"
704
+ ],
705
+ "onDelete": "cascade",
706
+ "onUpdate": "no action"
707
+ },
708
+ "email_logs_template_id_email_templates_id_fk": {
709
+ "name": "email_logs_template_id_email_templates_id_fk",
710
+ "tableFrom": "email_logs",
711
+ "tableTo": "email_templates",
712
+ "columnsFrom": [
713
+ "template_id"
714
+ ],
715
+ "columnsTo": [
716
+ "id"
717
+ ],
718
+ "onDelete": "no action",
719
+ "onUpdate": "no action"
720
+ }
721
+ },
722
+ "compositePrimaryKeys": {},
723
+ "uniqueConstraints": {},
724
+ "policies": {},
725
+ "checkConstraints": {},
726
+ "isRLSEnabled": false
727
+ },
728
+ "public.email_templates": {
729
+ "name": "email_templates",
730
+ "schema": "",
731
+ "columns": {
732
+ "id": {
733
+ "name": "id",
734
+ "type": "text",
735
+ "primaryKey": true,
736
+ "notNull": true
737
+ },
738
+ "user_id": {
739
+ "name": "user_id",
740
+ "type": "text",
741
+ "primaryKey": false,
742
+ "notNull": true
743
+ },
744
+ "name": {
745
+ "name": "name",
746
+ "type": "text",
747
+ "primaryKey": false,
748
+ "notNull": true
749
+ },
750
+ "subject": {
751
+ "name": "subject",
752
+ "type": "text",
753
+ "primaryKey": false,
754
+ "notNull": true
755
+ },
756
+ "body": {
757
+ "name": "body",
758
+ "type": "text",
759
+ "primaryKey": false,
760
+ "notNull": true
761
+ },
762
+ "is_default": {
763
+ "name": "is_default",
764
+ "type": "boolean",
765
+ "primaryKey": false,
766
+ "notNull": true,
767
+ "default": false
768
+ },
769
+ "created_at": {
770
+ "name": "created_at",
771
+ "type": "timestamp",
772
+ "primaryKey": false,
773
+ "notNull": true,
774
+ "default": "now()"
775
+ },
776
+ "updated_at": {
777
+ "name": "updated_at",
778
+ "type": "timestamp",
779
+ "primaryKey": false,
780
+ "notNull": true,
781
+ "default": "now()"
782
+ }
783
+ },
784
+ "indexes": {
785
+ "email_templates_user_idx": {
786
+ "name": "email_templates_user_idx",
787
+ "columns": [
788
+ {
789
+ "expression": "user_id",
790
+ "isExpression": false,
791
+ "asc": true,
792
+ "nulls": "last"
793
+ }
794
+ ],
795
+ "isUnique": false,
796
+ "concurrently": false,
797
+ "method": "btree",
798
+ "with": {}
799
+ },
800
+ "email_templates_default_idx": {
801
+ "name": "email_templates_default_idx",
802
+ "columns": [
803
+ {
804
+ "expression": "is_default",
805
+ "isExpression": false,
806
+ "asc": true,
807
+ "nulls": "last"
808
+ }
809
+ ],
810
+ "isUnique": false,
811
+ "concurrently": false,
812
+ "method": "btree",
813
+ "with": {}
814
+ }
815
+ },
816
+ "foreignKeys": {
817
+ "email_templates_user_id_users_id_fk": {
818
+ "name": "email_templates_user_id_users_id_fk",
819
+ "tableFrom": "email_templates",
820
+ "tableTo": "users",
821
+ "columnsFrom": [
822
+ "user_id"
823
+ ],
824
+ "columnsTo": [
825
+ "id"
826
+ ],
827
+ "onDelete": "cascade",
828
+ "onUpdate": "no action"
829
+ }
830
+ },
831
+ "compositePrimaryKeys": {},
832
+ "uniqueConstraints": {},
833
+ "policies": {},
834
+ "checkConstraints": {},
835
+ "isRLSEnabled": false
836
+ },
837
+ "public.feedback": {
838
+ "name": "feedback",
839
+ "schema": "",
840
+ "columns": {
841
+ "id": {
842
+ "name": "id",
843
+ "type": "text",
844
+ "primaryKey": true,
845
+ "notNull": true
846
+ },
847
+ "user_id": {
848
+ "name": "user_id",
849
+ "type": "text",
850
+ "primaryKey": false,
851
+ "notNull": false
852
+ },
853
+ "visitor_name": {
854
+ "name": "visitor_name",
855
+ "type": "text",
856
+ "primaryKey": false,
857
+ "notNull": false
858
+ },
859
+ "visitor_email": {
860
+ "name": "visitor_email",
861
+ "type": "text",
862
+ "primaryKey": false,
863
+ "notNull": false
864
+ },
865
+ "subject": {
866
+ "name": "subject",
867
+ "type": "text",
868
+ "primaryKey": false,
869
+ "notNull": false
870
+ },
871
+ "message": {
872
+ "name": "message",
873
+ "type": "text",
874
+ "primaryKey": false,
875
+ "notNull": true
876
+ },
877
+ "type": {
878
+ "name": "type",
879
+ "type": "varchar(20)",
880
+ "primaryKey": false,
881
+ "notNull": true,
882
+ "default": "'general'"
883
+ },
884
+ "status": {
885
+ "name": "status",
886
+ "type": "varchar(20)",
887
+ "primaryKey": false,
888
+ "notNull": true,
889
+ "default": "'new'"
890
+ },
891
+ "created_at": {
892
+ "name": "created_at",
893
+ "type": "timestamp",
894
+ "primaryKey": false,
895
+ "notNull": true,
896
+ "default": "now()"
897
+ }
898
+ },
899
+ "indexes": {},
900
+ "foreignKeys": {
901
+ "feedback_user_id_users_id_fk": {
902
+ "name": "feedback_user_id_users_id_fk",
903
+ "tableFrom": "feedback",
904
+ "tableTo": "users",
905
+ "columnsFrom": [
906
+ "user_id"
907
+ ],
908
+ "columnsTo": [
909
+ "id"
910
+ ],
911
+ "onDelete": "set null",
912
+ "onUpdate": "no action"
913
+ }
914
+ },
915
+ "compositePrimaryKeys": {},
916
+ "uniqueConstraints": {},
917
+ "policies": {},
918
+ "checkConstraints": {},
919
+ "isRLSEnabled": false
920
+ },
921
+ "public.notifications": {
922
+ "name": "notifications",
923
+ "schema": "",
924
+ "columns": {
925
+ "id": {
926
+ "name": "id",
927
+ "type": "text",
928
+ "primaryKey": true,
929
+ "notNull": true
930
+ },
931
+ "user_id": {
932
+ "name": "user_id",
933
+ "type": "text",
934
+ "primaryKey": false,
935
+ "notNull": false
936
+ },
937
+ "title": {
938
+ "name": "title",
939
+ "type": "text",
940
+ "primaryKey": false,
941
+ "notNull": true
942
+ },
943
+ "message": {
944
+ "name": "message",
945
+ "type": "text",
946
+ "primaryKey": false,
947
+ "notNull": true
948
+ },
949
+ "type": {
950
+ "name": "type",
951
+ "type": "varchar(20)",
952
+ "primaryKey": false,
953
+ "notNull": true,
954
+ "default": "'info'"
955
+ },
956
+ "read": {
957
+ "name": "read",
958
+ "type": "boolean",
959
+ "primaryKey": false,
960
+ "notNull": true,
961
+ "default": false
962
+ },
963
+ "created_at": {
964
+ "name": "created_at",
965
+ "type": "timestamp",
966
+ "primaryKey": false,
967
+ "notNull": true,
968
+ "default": "now()"
969
+ }
970
+ },
971
+ "indexes": {},
972
+ "foreignKeys": {
973
+ "notifications_user_id_users_id_fk": {
974
+ "name": "notifications_user_id_users_id_fk",
975
+ "tableFrom": "notifications",
976
+ "tableTo": "users",
977
+ "columnsFrom": [
978
+ "user_id"
979
+ ],
980
+ "columnsTo": [
981
+ "id"
982
+ ],
983
+ "onDelete": "cascade",
984
+ "onUpdate": "no action"
985
+ }
986
+ },
987
+ "compositePrimaryKeys": {},
988
+ "uniqueConstraints": {},
989
+ "policies": {},
990
+ "checkConstraints": {},
991
+ "isRLSEnabled": false
992
+ },
993
+ "public.scraping_jobs": {
994
+ "name": "scraping_jobs",
995
+ "schema": "",
996
+ "columns": {
997
+ "id": {
998
+ "name": "id",
999
+ "type": "text",
1000
+ "primaryKey": true,
1001
+ "notNull": true
1002
+ },
1003
+ "user_id": {
1004
+ "name": "user_id",
1005
+ "type": "text",
1006
+ "primaryKey": false,
1007
+ "notNull": true
1008
+ },
1009
+ "workflow_id": {
1010
+ "name": "workflow_id",
1011
+ "type": "text",
1012
+ "primaryKey": false,
1013
+ "notNull": false
1014
+ },
1015
+ "keywords": {
1016
+ "name": "keywords",
1017
+ "type": "jsonb",
1018
+ "primaryKey": false,
1019
+ "notNull": true
1020
+ },
1021
+ "status": {
1022
+ "name": "status",
1023
+ "type": "varchar(20)",
1024
+ "primaryKey": false,
1025
+ "notNull": true
1026
+ },
1027
+ "priority": {
1028
+ "name": "priority",
1029
+ "type": "varchar(10)",
1030
+ "primaryKey": false,
1031
+ "notNull": true,
1032
+ "default": "'medium'"
1033
+ },
1034
+ "businesses_found": {
1035
+ "name": "businesses_found",
1036
+ "type": "integer",
1037
+ "primaryKey": false,
1038
+ "notNull": true,
1039
+ "default": 0
1040
+ },
1041
+ "created_at": {
1042
+ "name": "created_at",
1043
+ "type": "timestamp",
1044
+ "primaryKey": false,
1045
+ "notNull": true,
1046
+ "default": "now()"
1047
+ },
1048
+ "completed_at": {
1049
+ "name": "completed_at",
1050
+ "type": "timestamp",
1051
+ "primaryKey": false,
1052
+ "notNull": false
1053
+ }
1054
+ },
1055
+ "indexes": {},
1056
+ "foreignKeys": {
1057
+ "scraping_jobs_user_id_users_id_fk": {
1058
+ "name": "scraping_jobs_user_id_users_id_fk",
1059
+ "tableFrom": "scraping_jobs",
1060
+ "tableTo": "users",
1061
+ "columnsFrom": [
1062
+ "user_id"
1063
+ ],
1064
+ "columnsTo": [
1065
+ "id"
1066
+ ],
1067
+ "onDelete": "cascade",
1068
+ "onUpdate": "no action"
1069
+ },
1070
+ "scraping_jobs_workflow_id_automation_workflows_id_fk": {
1071
+ "name": "scraping_jobs_workflow_id_automation_workflows_id_fk",
1072
+ "tableFrom": "scraping_jobs",
1073
+ "tableTo": "automation_workflows",
1074
+ "columnsFrom": [
1075
+ "workflow_id"
1076
+ ],
1077
+ "columnsTo": [
1078
+ "id"
1079
+ ],
1080
+ "onDelete": "cascade",
1081
+ "onUpdate": "no action"
1082
+ }
1083
+ },
1084
+ "compositePrimaryKeys": {},
1085
+ "uniqueConstraints": {},
1086
+ "policies": {},
1087
+ "checkConstraints": {},
1088
+ "isRLSEnabled": false
1089
+ },
1090
+ "public.social_automations": {
1091
+ "name": "social_automations",
1092
+ "schema": "",
1093
+ "columns": {
1094
+ "id": {
1095
+ "name": "id",
1096
+ "type": "text",
1097
+ "primaryKey": true,
1098
+ "notNull": true
1099
+ },
1100
+ "user_id": {
1101
+ "name": "user_id",
1102
+ "type": "text",
1103
+ "primaryKey": false,
1104
+ "notNull": true
1105
+ },
1106
+ "connected_account_id": {
1107
+ "name": "connected_account_id",
1108
+ "type": "text",
1109
+ "primaryKey": false,
1110
+ "notNull": false
1111
+ },
1112
+ "name": {
1113
+ "name": "name",
1114
+ "type": "text",
1115
+ "primaryKey": false,
1116
+ "notNull": true
1117
+ },
1118
+ "trigger_type": {
1119
+ "name": "trigger_type",
1120
+ "type": "varchar(50)",
1121
+ "primaryKey": false,
1122
+ "notNull": true
1123
+ },
1124
+ "keywords": {
1125
+ "name": "keywords",
1126
+ "type": "jsonb",
1127
+ "primaryKey": false,
1128
+ "notNull": false
1129
+ },
1130
+ "action_type": {
1131
+ "name": "action_type",
1132
+ "type": "varchar(50)",
1133
+ "primaryKey": false,
1134
+ "notNull": true
1135
+ },
1136
+ "response_template": {
1137
+ "name": "response_template",
1138
+ "type": "text",
1139
+ "primaryKey": false,
1140
+ "notNull": false
1141
+ },
1142
+ "is_active": {
1143
+ "name": "is_active",
1144
+ "type": "boolean",
1145
+ "primaryKey": false,
1146
+ "notNull": true,
1147
+ "default": true
1148
+ },
1149
+ "created_at": {
1150
+ "name": "created_at",
1151
+ "type": "timestamp",
1152
+ "primaryKey": false,
1153
+ "notNull": true,
1154
+ "default": "now()"
1155
+ },
1156
+ "updated_at": {
1157
+ "name": "updated_at",
1158
+ "type": "timestamp",
1159
+ "primaryKey": false,
1160
+ "notNull": true,
1161
+ "default": "now()"
1162
+ }
1163
+ },
1164
+ "indexes": {},
1165
+ "foreignKeys": {
1166
+ "social_automations_user_id_users_id_fk": {
1167
+ "name": "social_automations_user_id_users_id_fk",
1168
+ "tableFrom": "social_automations",
1169
+ "tableTo": "users",
1170
+ "columnsFrom": [
1171
+ "user_id"
1172
+ ],
1173
+ "columnsTo": [
1174
+ "id"
1175
+ ],
1176
+ "onDelete": "cascade",
1177
+ "onUpdate": "no action"
1178
+ },
1179
+ "social_automations_connected_account_id_connected_accounts_id_fk": {
1180
+ "name": "social_automations_connected_account_id_connected_accounts_id_fk",
1181
+ "tableFrom": "social_automations",
1182
+ "tableTo": "connected_accounts",
1183
+ "columnsFrom": [
1184
+ "connected_account_id"
1185
+ ],
1186
+ "columnsTo": [
1187
+ "id"
1188
+ ],
1189
+ "onDelete": "cascade",
1190
+ "onUpdate": "no action"
1191
+ }
1192
+ },
1193
+ "compositePrimaryKeys": {},
1194
+ "uniqueConstraints": {},
1195
+ "policies": {},
1196
+ "checkConstraints": {},
1197
+ "isRLSEnabled": false
1198
+ },
1199
+ "public.social_posts": {
1200
+ "name": "social_posts",
1201
+ "schema": "",
1202
+ "columns": {
1203
+ "id": {
1204
+ "name": "id",
1205
+ "type": "text",
1206
+ "primaryKey": true,
1207
+ "notNull": true
1208
+ },
1209
+ "user_id": {
1210
+ "name": "user_id",
1211
+ "type": "text",
1212
+ "primaryKey": false,
1213
+ "notNull": true
1214
+ },
1215
+ "connected_account_id": {
1216
+ "name": "connected_account_id",
1217
+ "type": "text",
1218
+ "primaryKey": false,
1219
+ "notNull": false
1220
+ },
1221
+ "content": {
1222
+ "name": "content",
1223
+ "type": "text",
1224
+ "primaryKey": false,
1225
+ "notNull": false
1226
+ },
1227
+ "media_urls": {
1228
+ "name": "media_urls",
1229
+ "type": "jsonb",
1230
+ "primaryKey": false,
1231
+ "notNull": false
1232
+ },
1233
+ "scheduled_at": {
1234
+ "name": "scheduled_at",
1235
+ "type": "timestamp",
1236
+ "primaryKey": false,
1237
+ "notNull": false
1238
+ },
1239
+ "status": {
1240
+ "name": "status",
1241
+ "type": "varchar(20)",
1242
+ "primaryKey": false,
1243
+ "notNull": true,
1244
+ "default": "'draft'"
1245
+ },
1246
+ "platform": {
1247
+ "name": "platform",
1248
+ "type": "varchar(20)",
1249
+ "primaryKey": false,
1250
+ "notNull": true
1251
+ },
1252
+ "published_at": {
1253
+ "name": "published_at",
1254
+ "type": "timestamp",
1255
+ "primaryKey": false,
1256
+ "notNull": false
1257
+ },
1258
+ "platform_post_id": {
1259
+ "name": "platform_post_id",
1260
+ "type": "text",
1261
+ "primaryKey": false,
1262
+ "notNull": false
1263
+ },
1264
+ "error": {
1265
+ "name": "error",
1266
+ "type": "text",
1267
+ "primaryKey": false,
1268
+ "notNull": false
1269
+ },
1270
+ "created_at": {
1271
+ "name": "created_at",
1272
+ "type": "timestamp",
1273
+ "primaryKey": false,
1274
+ "notNull": true,
1275
+ "default": "now()"
1276
+ },
1277
+ "updated_at": {
1278
+ "name": "updated_at",
1279
+ "type": "timestamp",
1280
+ "primaryKey": false,
1281
+ "notNull": true,
1282
+ "default": "now()"
1283
+ }
1284
+ },
1285
+ "indexes": {},
1286
+ "foreignKeys": {
1287
+ "social_posts_user_id_users_id_fk": {
1288
+ "name": "social_posts_user_id_users_id_fk",
1289
+ "tableFrom": "social_posts",
1290
+ "tableTo": "users",
1291
+ "columnsFrom": [
1292
+ "user_id"
1293
+ ],
1294
+ "columnsTo": [
1295
+ "id"
1296
+ ],
1297
+ "onDelete": "cascade",
1298
+ "onUpdate": "no action"
1299
+ },
1300
+ "social_posts_connected_account_id_connected_accounts_id_fk": {
1301
+ "name": "social_posts_connected_account_id_connected_accounts_id_fk",
1302
+ "tableFrom": "social_posts",
1303
+ "tableTo": "connected_accounts",
1304
+ "columnsFrom": [
1305
+ "connected_account_id"
1306
+ ],
1307
+ "columnsTo": [
1308
+ "id"
1309
+ ],
1310
+ "onDelete": "set null",
1311
+ "onUpdate": "no action"
1312
+ }
1313
+ },
1314
+ "compositePrimaryKeys": {},
1315
+ "uniqueConstraints": {},
1316
+ "policies": {},
1317
+ "checkConstraints": {},
1318
+ "isRLSEnabled": false
1319
+ },
1320
+ "public.users": {
1321
+ "name": "users",
1322
+ "schema": "",
1323
+ "columns": {
1324
+ "id": {
1325
+ "name": "id",
1326
+ "type": "text",
1327
+ "primaryKey": true,
1328
+ "notNull": true
1329
+ },
1330
+ "email": {
1331
+ "name": "email",
1332
+ "type": "text",
1333
+ "primaryKey": false,
1334
+ "notNull": true
1335
+ },
1336
+ "name": {
1337
+ "name": "name",
1338
+ "type": "text",
1339
+ "primaryKey": false,
1340
+ "notNull": false
1341
+ },
1342
+ "image": {
1343
+ "name": "image",
1344
+ "type": "text",
1345
+ "primaryKey": false,
1346
+ "notNull": false
1347
+ },
1348
+ "access_token": {
1349
+ "name": "access_token",
1350
+ "type": "text",
1351
+ "primaryKey": false,
1352
+ "notNull": false
1353
+ },
1354
+ "refresh_token": {
1355
+ "name": "refresh_token",
1356
+ "type": "text",
1357
+ "primaryKey": false,
1358
+ "notNull": false
1359
+ },
1360
+ "created_at": {
1361
+ "name": "created_at",
1362
+ "type": "timestamp",
1363
+ "primaryKey": false,
1364
+ "notNull": true,
1365
+ "default": "now()"
1366
+ },
1367
+ "updated_at": {
1368
+ "name": "updated_at",
1369
+ "type": "timestamp",
1370
+ "primaryKey": false,
1371
+ "notNull": true,
1372
+ "default": "now()"
1373
+ },
1374
+ "gemini_api_key": {
1375
+ "name": "gemini_api_key",
1376
+ "type": "text",
1377
+ "primaryKey": false,
1378
+ "notNull": false
1379
+ },
1380
+ "phone": {
1381
+ "name": "phone",
1382
+ "type": "text",
1383
+ "primaryKey": false,
1384
+ "notNull": false
1385
+ },
1386
+ "job_title": {
1387
+ "name": "job_title",
1388
+ "type": "text",
1389
+ "primaryKey": false,
1390
+ "notNull": false
1391
+ },
1392
+ "company": {
1393
+ "name": "company",
1394
+ "type": "text",
1395
+ "primaryKey": false,
1396
+ "notNull": false
1397
+ },
1398
+ "website": {
1399
+ "name": "website",
1400
+ "type": "text",
1401
+ "primaryKey": false,
1402
+ "notNull": false
1403
+ },
1404
+ "custom_variables": {
1405
+ "name": "custom_variables",
1406
+ "type": "jsonb",
1407
+ "primaryKey": false,
1408
+ "notNull": false
1409
+ },
1410
+ "linkedin_session_cookie": {
1411
+ "name": "linkedin_session_cookie",
1412
+ "type": "text",
1413
+ "primaryKey": false,
1414
+ "notNull": false
1415
+ }
1416
+ },
1417
+ "indexes": {},
1418
+ "foreignKeys": {},
1419
+ "compositePrimaryKeys": {},
1420
+ "uniqueConstraints": {
1421
+ "users_email_unique": {
1422
+ "name": "users_email_unique",
1423
+ "nullsNotDistinct": false,
1424
+ "columns": [
1425
+ "email"
1426
+ ]
1427
+ }
1428
+ },
1429
+ "policies": {},
1430
+ "checkConstraints": {},
1431
+ "isRLSEnabled": false
1432
+ },
1433
+ "public.whatsapp_messages": {
1434
+ "name": "whatsapp_messages",
1435
+ "schema": "",
1436
+ "columns": {
1437
+ "id": {
1438
+ "name": "id",
1439
+ "type": "text",
1440
+ "primaryKey": true,
1441
+ "notNull": true
1442
+ },
1443
+ "wamid": {
1444
+ "name": "wamid",
1445
+ "type": "text",
1446
+ "primaryKey": false,
1447
+ "notNull": false
1448
+ },
1449
+ "phone_number": {
1450
+ "name": "phone_number",
1451
+ "type": "text",
1452
+ "primaryKey": false,
1453
+ "notNull": true
1454
+ },
1455
+ "direction": {
1456
+ "name": "direction",
1457
+ "type": "varchar(10)",
1458
+ "primaryKey": false,
1459
+ "notNull": true
1460
+ },
1461
+ "type": {
1462
+ "name": "type",
1463
+ "type": "varchar(20)",
1464
+ "primaryKey": false,
1465
+ "notNull": false,
1466
+ "default": "'text'"
1467
+ },
1468
+ "status": {
1469
+ "name": "status",
1470
+ "type": "varchar(20)",
1471
+ "primaryKey": false,
1472
+ "notNull": false,
1473
+ "default": "'sent'"
1474
+ },
1475
+ "body": {
1476
+ "name": "body",
1477
+ "type": "text",
1478
+ "primaryKey": false,
1479
+ "notNull": false
1480
+ },
1481
+ "created_at": {
1482
+ "name": "created_at",
1483
+ "type": "timestamp",
1484
+ "primaryKey": false,
1485
+ "notNull": true,
1486
+ "default": "now()"
1487
+ },
1488
+ "updated_at": {
1489
+ "name": "updated_at",
1490
+ "type": "timestamp",
1491
+ "primaryKey": false,
1492
+ "notNull": true,
1493
+ "default": "now()"
1494
+ }
1495
+ },
1496
+ "indexes": {},
1497
+ "foreignKeys": {},
1498
+ "compositePrimaryKeys": {},
1499
+ "uniqueConstraints": {
1500
+ "whatsapp_messages_wamid_unique": {
1501
+ "name": "whatsapp_messages_wamid_unique",
1502
+ "nullsNotDistinct": false,
1503
+ "columns": [
1504
+ "wamid"
1505
+ ]
1506
+ }
1507
+ },
1508
+ "policies": {},
1509
+ "checkConstraints": {},
1510
+ "isRLSEnabled": false
1511
+ },
1512
+ "public.workflow_execution_logs": {
1513
+ "name": "workflow_execution_logs",
1514
+ "schema": "",
1515
+ "columns": {
1516
+ "id": {
1517
+ "name": "id",
1518
+ "type": "text",
1519
+ "primaryKey": true,
1520
+ "notNull": true
1521
+ },
1522
+ "workflow_id": {
1523
+ "name": "workflow_id",
1524
+ "type": "text",
1525
+ "primaryKey": false,
1526
+ "notNull": true
1527
+ },
1528
+ "business_id": {
1529
+ "name": "business_id",
1530
+ "type": "text",
1531
+ "primaryKey": false,
1532
+ "notNull": false
1533
+ },
1534
+ "user_id": {
1535
+ "name": "user_id",
1536
+ "type": "text",
1537
+ "primaryKey": false,
1538
+ "notNull": true
1539
+ },
1540
+ "status": {
1541
+ "name": "status",
1542
+ "type": "varchar(20)",
1543
+ "primaryKey": false,
1544
+ "notNull": true
1545
+ },
1546
+ "logs": {
1547
+ "name": "logs",
1548
+ "type": "text",
1549
+ "primaryKey": false,
1550
+ "notNull": false
1551
+ },
1552
+ "state": {
1553
+ "name": "state",
1554
+ "type": "jsonb",
1555
+ "primaryKey": false,
1556
+ "notNull": false
1557
+ },
1558
+ "error": {
1559
+ "name": "error",
1560
+ "type": "text",
1561
+ "primaryKey": false,
1562
+ "notNull": false
1563
+ },
1564
+ "started_at": {
1565
+ "name": "started_at",
1566
+ "type": "timestamp",
1567
+ "primaryKey": false,
1568
+ "notNull": false
1569
+ },
1570
+ "completed_at": {
1571
+ "name": "completed_at",
1572
+ "type": "timestamp",
1573
+ "primaryKey": false,
1574
+ "notNull": false
1575
+ },
1576
+ "created_at": {
1577
+ "name": "created_at",
1578
+ "type": "timestamp",
1579
+ "primaryKey": false,
1580
+ "notNull": true,
1581
+ "default": "now()"
1582
+ },
1583
+ "updated_at": {
1584
+ "name": "updated_at",
1585
+ "type": "timestamp",
1586
+ "primaryKey": false,
1587
+ "notNull": true,
1588
+ "default": "now()"
1589
+ },
1590
+ "metadata": {
1591
+ "name": "metadata",
1592
+ "type": "jsonb",
1593
+ "primaryKey": false,
1594
+ "notNull": false
1595
+ }
1596
+ },
1597
+ "indexes": {
1598
+ "exec_workflow_id_idx": {
1599
+ "name": "exec_workflow_id_idx",
1600
+ "columns": [
1601
+ {
1602
+ "expression": "workflow_id",
1603
+ "isExpression": false,
1604
+ "asc": true,
1605
+ "nulls": "last"
1606
+ }
1607
+ ],
1608
+ "isUnique": false,
1609
+ "concurrently": false,
1610
+ "method": "btree",
1611
+ "with": {}
1612
+ },
1613
+ "exec_started_at_idx": {
1614
+ "name": "exec_started_at_idx",
1615
+ "columns": [
1616
+ {
1617
+ "expression": "started_at",
1618
+ "isExpression": false,
1619
+ "asc": true,
1620
+ "nulls": "last"
1621
+ }
1622
+ ],
1623
+ "isUnique": false,
1624
+ "concurrently": false,
1625
+ "method": "btree",
1626
+ "with": {}
1627
+ }
1628
+ },
1629
+ "foreignKeys": {
1630
+ "workflow_execution_logs_workflow_id_automation_workflows_id_fk": {
1631
+ "name": "workflow_execution_logs_workflow_id_automation_workflows_id_fk",
1632
+ "tableFrom": "workflow_execution_logs",
1633
+ "tableTo": "automation_workflows",
1634
+ "columnsFrom": [
1635
+ "workflow_id"
1636
+ ],
1637
+ "columnsTo": [
1638
+ "id"
1639
+ ],
1640
+ "onDelete": "cascade",
1641
+ "onUpdate": "no action"
1642
+ },
1643
+ "workflow_execution_logs_business_id_businesses_id_fk": {
1644
+ "name": "workflow_execution_logs_business_id_businesses_id_fk",
1645
+ "tableFrom": "workflow_execution_logs",
1646
+ "tableTo": "businesses",
1647
+ "columnsFrom": [
1648
+ "business_id"
1649
+ ],
1650
+ "columnsTo": [
1651
+ "id"
1652
+ ],
1653
+ "onDelete": "set null",
1654
+ "onUpdate": "no action"
1655
+ },
1656
+ "workflow_execution_logs_user_id_users_id_fk": {
1657
+ "name": "workflow_execution_logs_user_id_users_id_fk",
1658
+ "tableFrom": "workflow_execution_logs",
1659
+ "tableTo": "users",
1660
+ "columnsFrom": [
1661
+ "user_id"
1662
+ ],
1663
+ "columnsTo": [
1664
+ "id"
1665
+ ],
1666
+ "onDelete": "cascade",
1667
+ "onUpdate": "no action"
1668
+ }
1669
+ },
1670
+ "compositePrimaryKeys": {},
1671
+ "uniqueConstraints": {},
1672
+ "policies": {},
1673
+ "checkConstraints": {},
1674
+ "isRLSEnabled": false
1675
+ },
1676
+ "public.workflow_trigger_executions": {
1677
+ "name": "workflow_trigger_executions",
1678
+ "schema": "",
1679
+ "columns": {
1680
+ "id": {
1681
+ "name": "id",
1682
+ "type": "text",
1683
+ "primaryKey": true,
1684
+ "notNull": true
1685
+ },
1686
+ "trigger_id": {
1687
+ "name": "trigger_id",
1688
+ "type": "text",
1689
+ "primaryKey": false,
1690
+ "notNull": true
1691
+ },
1692
+ "workflow_id": {
1693
+ "name": "workflow_id",
1694
+ "type": "text",
1695
+ "primaryKey": false,
1696
+ "notNull": true
1697
+ },
1698
+ "business_id": {
1699
+ "name": "business_id",
1700
+ "type": "text",
1701
+ "primaryKey": false,
1702
+ "notNull": false
1703
+ },
1704
+ "status": {
1705
+ "name": "status",
1706
+ "type": "varchar(20)",
1707
+ "primaryKey": false,
1708
+ "notNull": true
1709
+ },
1710
+ "error": {
1711
+ "name": "error",
1712
+ "type": "text",
1713
+ "primaryKey": false,
1714
+ "notNull": false
1715
+ },
1716
+ "executed_at": {
1717
+ "name": "executed_at",
1718
+ "type": "timestamp",
1719
+ "primaryKey": false,
1720
+ "notNull": false
1721
+ },
1722
+ "created_at": {
1723
+ "name": "created_at",
1724
+ "type": "timestamp",
1725
+ "primaryKey": false,
1726
+ "notNull": false,
1727
+ "default": "now()"
1728
+ }
1729
+ },
1730
+ "indexes": {
1731
+ "exec_trigger_id_idx": {
1732
+ "name": "exec_trigger_id_idx",
1733
+ "columns": [
1734
+ {
1735
+ "expression": "trigger_id",
1736
+ "isExpression": false,
1737
+ "asc": true,
1738
+ "nulls": "last"
1739
+ }
1740
+ ],
1741
+ "isUnique": false,
1742
+ "concurrently": false,
1743
+ "method": "btree",
1744
+ "with": {}
1745
+ },
1746
+ "trigger_exec_workflow_id_idx": {
1747
+ "name": "trigger_exec_workflow_id_idx",
1748
+ "columns": [
1749
+ {
1750
+ "expression": "workflow_id",
1751
+ "isExpression": false,
1752
+ "asc": true,
1753
+ "nulls": "last"
1754
+ }
1755
+ ],
1756
+ "isUnique": false,
1757
+ "concurrently": false,
1758
+ "method": "btree",
1759
+ "with": {}
1760
+ }
1761
+ },
1762
+ "foreignKeys": {
1763
+ "workflow_trigger_executions_trigger_id_workflow_triggers_id_fk": {
1764
+ "name": "workflow_trigger_executions_trigger_id_workflow_triggers_id_fk",
1765
+ "tableFrom": "workflow_trigger_executions",
1766
+ "tableTo": "workflow_triggers",
1767
+ "columnsFrom": [
1768
+ "trigger_id"
1769
+ ],
1770
+ "columnsTo": [
1771
+ "id"
1772
+ ],
1773
+ "onDelete": "cascade",
1774
+ "onUpdate": "no action"
1775
+ },
1776
+ "workflow_trigger_executions_workflow_id_automation_workflows_id_fk": {
1777
+ "name": "workflow_trigger_executions_workflow_id_automation_workflows_id_fk",
1778
+ "tableFrom": "workflow_trigger_executions",
1779
+ "tableTo": "automation_workflows",
1780
+ "columnsFrom": [
1781
+ "workflow_id"
1782
+ ],
1783
+ "columnsTo": [
1784
+ "id"
1785
+ ],
1786
+ "onDelete": "cascade",
1787
+ "onUpdate": "no action"
1788
+ },
1789
+ "workflow_trigger_executions_business_id_businesses_id_fk": {
1790
+ "name": "workflow_trigger_executions_business_id_businesses_id_fk",
1791
+ "tableFrom": "workflow_trigger_executions",
1792
+ "tableTo": "businesses",
1793
+ "columnsFrom": [
1794
+ "business_id"
1795
+ ],
1796
+ "columnsTo": [
1797
+ "id"
1798
+ ],
1799
+ "onDelete": "set null",
1800
+ "onUpdate": "no action"
1801
+ }
1802
+ },
1803
+ "compositePrimaryKeys": {},
1804
+ "uniqueConstraints": {},
1805
+ "policies": {},
1806
+ "checkConstraints": {},
1807
+ "isRLSEnabled": false
1808
+ },
1809
+ "public.workflow_triggers": {
1810
+ "name": "workflow_triggers",
1811
+ "schema": "",
1812
+ "columns": {
1813
+ "id": {
1814
+ "name": "id",
1815
+ "type": "text",
1816
+ "primaryKey": true,
1817
+ "notNull": true
1818
+ },
1819
+ "workflow_id": {
1820
+ "name": "workflow_id",
1821
+ "type": "text",
1822
+ "primaryKey": false,
1823
+ "notNull": true
1824
+ },
1825
+ "user_id": {
1826
+ "name": "user_id",
1827
+ "type": "text",
1828
+ "primaryKey": false,
1829
+ "notNull": true
1830
+ },
1831
+ "trigger_type": {
1832
+ "name": "trigger_type",
1833
+ "type": "varchar(50)",
1834
+ "primaryKey": false,
1835
+ "notNull": true
1836
+ },
1837
+ "config": {
1838
+ "name": "config",
1839
+ "type": "jsonb",
1840
+ "primaryKey": false,
1841
+ "notNull": false
1842
+ },
1843
+ "is_active": {
1844
+ "name": "is_active",
1845
+ "type": "boolean",
1846
+ "primaryKey": false,
1847
+ "notNull": false,
1848
+ "default": true
1849
+ },
1850
+ "last_run_at": {
1851
+ "name": "last_run_at",
1852
+ "type": "timestamp",
1853
+ "primaryKey": false,
1854
+ "notNull": false
1855
+ },
1856
+ "next_run_at": {
1857
+ "name": "next_run_at",
1858
+ "type": "timestamp",
1859
+ "primaryKey": false,
1860
+ "notNull": false
1861
+ },
1862
+ "created_at": {
1863
+ "name": "created_at",
1864
+ "type": "timestamp",
1865
+ "primaryKey": false,
1866
+ "notNull": false,
1867
+ "default": "now()"
1868
+ },
1869
+ "updated_at": {
1870
+ "name": "updated_at",
1871
+ "type": "timestamp",
1872
+ "primaryKey": false,
1873
+ "notNull": false,
1874
+ "default": "now()"
1875
+ }
1876
+ },
1877
+ "indexes": {},
1878
+ "foreignKeys": {
1879
+ "workflow_triggers_workflow_id_automation_workflows_id_fk": {
1880
+ "name": "workflow_triggers_workflow_id_automation_workflows_id_fk",
1881
+ "tableFrom": "workflow_triggers",
1882
+ "tableTo": "automation_workflows",
1883
+ "columnsFrom": [
1884
+ "workflow_id"
1885
+ ],
1886
+ "columnsTo": [
1887
+ "id"
1888
+ ],
1889
+ "onDelete": "cascade",
1890
+ "onUpdate": "no action"
1891
+ },
1892
+ "workflow_triggers_user_id_users_id_fk": {
1893
+ "name": "workflow_triggers_user_id_users_id_fk",
1894
+ "tableFrom": "workflow_triggers",
1895
+ "tableTo": "users",
1896
+ "columnsFrom": [
1897
+ "user_id"
1898
+ ],
1899
+ "columnsTo": [
1900
+ "id"
1901
+ ],
1902
+ "onDelete": "cascade",
1903
+ "onUpdate": "no action"
1904
+ }
1905
+ },
1906
+ "compositePrimaryKeys": {},
1907
+ "uniqueConstraints": {},
1908
+ "policies": {},
1909
+ "checkConstraints": {},
1910
+ "isRLSEnabled": false
1911
+ }
1912
+ },
1913
+ "enums": {},
1914
+ "schemas": {},
1915
+ "sequences": {},
1916
+ "roles": {},
1917
+ "policies": {},
1918
+ "views": {},
1919
+ "_meta": {
1920
+ "columns": {},
1921
+ "schemas": {},
1922
+ "tables": {}
1923
+ }
1924
+ }
drizzle/meta/_journal.json CHANGED
@@ -15,6 +15,20 @@
15
  "when": 1769441834407,
16
  "tag": "0001_complex_warlock",
17
  "breakpoints": true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
  ]
20
  }
 
15
  "when": 1769441834407,
16
  "tag": "0001_complex_warlock",
17
  "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1769679184490,
23
+ "tag": "0002_lush_luckman",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1769679428671,
30
+ "tag": "0003_flaky_landau",
31
+ "breakpoints": true
32
  }
33
  ]
34
  }
lib/redis.ts CHANGED
@@ -23,8 +23,8 @@ if (process.env.NODE_ENV === "production" || !globalForRedis.redis) {
23
  console.log("Initializing Redis...");
24
  redis = new Redis(process.env.REDIS_URL, redisConfig);
25
  } else {
26
- console.warn("REDIS_URL is not defined. Using default localhost:6379");
27
- redis = new Redis({ ...redisConfig, host: 'localhost', port: 6379 });
28
  }
29
 
30
  redis.on('error', (err) => {
 
23
  console.log("Initializing Redis...");
24
  redis = new Redis(process.env.REDIS_URL, redisConfig);
25
  } else {
26
+ console.warn("REDIS_URL is not defined. Using default localhost:6379 with lazyConnect");
27
+ redis = new Redis({ ...redisConfig, host: 'localhost', port: 6379, lazyConnect: true });
28
  }
29
 
30
  redis.on('error', (err) => {