create-m5kdev 0.40.2 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/templates/minimal-app/.cursor/rules/frontend-component-guide.mdc +95 -95
  3. package/templates/minimal-app/.cursor/rules/frontend-data-guide.mdc +103 -103
  4. package/templates/minimal-app/.cursor/rules/frontend-form-guide.mdc +80 -80
  5. package/templates/minimal-app/.cursor/rules/frontend-hook-guide.mdc +79 -79
  6. package/templates/minimal-app/.cursor/rules/frontend-i18n-guide.mdc +45 -45
  7. package/templates/minimal-app/.cursor/rules/module-dto-guide.mdc +60 -60
  8. package/templates/minimal-app/.cursor/rules/module-prompt-guide.mdc +214 -214
  9. package/templates/minimal-app/.cursor/rules/module-repository-guide.mdc +167 -167
  10. package/templates/minimal-app/.cursor/rules/module-schema-guide.mdc +53 -53
  11. package/templates/minimal-app/.cursor/rules/module-service-guide.mdc +367 -367
  12. package/templates/minimal-app/.cursor/rules/module-trpc-guide.mdc +71 -71
  13. package/templates/minimal-app/apps/.gitignore.tpl +13 -13
  14. package/templates/minimal-app/apps/e2e/package.json.tpl +23 -23
  15. package/templates/minimal-app/apps/e2e/tests/standard.spec.ts.tpl +11 -22
  16. package/templates/minimal-app/apps/email/package.json.tpl +34 -34
  17. package/templates/minimal-app/apps/expo/.gitignore.tpl +44 -44
  18. package/templates/minimal-app/apps/expo/.prettierignore +13 -13
  19. package/templates/minimal-app/apps/expo/.prettierrc.json.tpl +9 -9
  20. package/templates/minimal-app/apps/expo/CHANGELOG.md.tpl +156 -156
  21. package/templates/minimal-app/apps/expo/README.md.tpl +44 -44
  22. package/templates/minimal-app/apps/expo/package.json.tpl +63 -63
  23. package/templates/minimal-app/apps/landing/package.json.tpl +34 -34
  24. package/templates/minimal-app/apps/server/drizzle/0000_whole_echo.sql +366 -366
  25. package/templates/minimal-app/apps/server/drizzle/0002_crazy_lilith.sql +46 -46
  26. package/templates/minimal-app/apps/server/drizzle/0003_freezing_fantastic_four.sql +3 -3
  27. package/templates/minimal-app/apps/server/drizzle/0004_slow_ezekiel_stane.sql +98 -98
  28. package/templates/minimal-app/apps/server/drizzle/0005_wonderful_the_professor.sql +1 -1
  29. package/templates/minimal-app/apps/server/drizzle/0006_lazy_blue_marvel.sql +158 -158
  30. package/templates/minimal-app/apps/server/drizzle/0007_abnormal_ultimo.sql +1 -1
  31. package/templates/minimal-app/apps/server/drizzle/0008_steady_nekra.sql +86 -86
  32. package/templates/minimal-app/apps/server/drizzle/0009_empty_starjammers.sql +45 -0
  33. package/templates/minimal-app/apps/server/drizzle/meta/0000_snapshot.json.tpl +2624 -2624
  34. package/templates/minimal-app/apps/server/drizzle/meta/0001_snapshot.json.tpl +2670 -2670
  35. package/templates/minimal-app/apps/server/drizzle/meta/0002_snapshot.json.tpl +2715 -2715
  36. package/templates/minimal-app/apps/server/drizzle/meta/0003_snapshot.json.tpl +2687 -2687
  37. package/templates/minimal-app/apps/server/drizzle/meta/0004_snapshot.json.tpl +2497 -2497
  38. package/templates/minimal-app/apps/server/drizzle/meta/0005_snapshot.json.tpl +2483 -2483
  39. package/templates/minimal-app/apps/server/drizzle/meta/0006_snapshot.json.tpl +3602 -3602
  40. package/templates/minimal-app/apps/server/drizzle/meta/0007_snapshot.json.tpl +3619 -3619
  41. package/templates/minimal-app/apps/server/drizzle/meta/0008_snapshot.json.tpl +3619 -3619
  42. package/templates/minimal-app/apps/server/drizzle/meta/0009_snapshot.json.tpl +3687 -0
  43. package/templates/minimal-app/apps/server/drizzle/meta/_journal.json.tpl +8 -1
  44. package/templates/minimal-app/apps/server/package.json.tpl +57 -57
  45. package/templates/minimal-app/apps/shared/package.json.tpl +27 -27
  46. package/templates/minimal-app/apps/webapp/AGENTS.md.tpl +24 -24
  47. package/templates/minimal-app/apps/webapp/index.html.tpl +22 -22
  48. package/templates/minimal-app/apps/webapp/package.json.tpl +53 -53
  49. package/templates/minimal-app/apps/webapp/public/logo.svg.tpl +6 -6
  50. package/templates/minimal-app/pnpm-workspace.yaml.tpl +15 -15
  51. package/templates/minimal-app/apps/expo/expo-env.d.ts.tpl +0 -3
  52. package/templates/minimal-app/apps/expo/uniwind-types.d.ts.tpl +0 -10
@@ -1,367 +1,367 @@
1
- CREATE TABLE `account_claim_magic_links` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `claim_id` text NOT NULL,
4
- `user_id` text NOT NULL,
5
- `email` text NOT NULL,
6
- `token` text NOT NULL,
7
- `url` text NOT NULL,
8
- `expires_at` integer,
9
- `created_at` integer NOT NULL,
10
- FOREIGN KEY (`claim_id`) REFERENCES `waitlist`(`id`) ON UPDATE no action ON DELETE cascade,
11
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
12
- );
13
- --> statement-breakpoint
14
- CREATE TABLE `accounts` (
15
- `id` text PRIMARY KEY NOT NULL,
16
- `account_id` text NOT NULL,
17
- `provider_id` text NOT NULL,
18
- `user_id` text NOT NULL,
19
- `access_token` text,
20
- `refresh_token` text,
21
- `id_token` text,
22
- `access_token_expires_at` integer,
23
- `refresh_token_expires_at` integer,
24
- `scope` text,
25
- `password` text,
26
- `created_at` integer NOT NULL,
27
- `updated_at` integer NOT NULL,
28
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
29
- );
30
- --> statement-breakpoint
31
- CREATE TABLE `ai_usage` (
32
- `id` text PRIMARY KEY NOT NULL,
33
- `user_id` text,
34
- `member_id` text,
35
- `team_id` text,
36
- `organization_id` text,
37
- `feature` text NOT NULL,
38
- `provider` text NOT NULL,
39
- `model` text NOT NULL,
40
- `input_tokens` integer,
41
- `output_tokens` integer,
42
- `total_tokens` integer,
43
- `cost` real,
44
- `trace_id` text,
45
- `created_at` integer NOT NULL,
46
- `metadata` text,
47
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
48
- FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE set null,
49
- FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE set null,
50
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null
51
- );
52
- --> statement-breakpoint
53
- CREATE TABLE `apikeys` (
54
- `id` text PRIMARY KEY NOT NULL,
55
- `name` text,
56
- `start` text,
57
- `prefix` text,
58
- `key` text NOT NULL,
59
- `user_id` text NOT NULL,
60
- `refill_interval` integer,
61
- `refill_amount` integer,
62
- `last_refill_at` integer,
63
- `enabled` integer NOT NULL,
64
- `rate_limit_enabled` integer NOT NULL,
65
- `rate_limit_time_window` integer,
66
- `rate_limit_max` integer,
67
- `request_count` integer NOT NULL,
68
- `remaining` integer,
69
- `last_request` integer,
70
- `expires_at` integer,
71
- `created_at` integer NOT NULL,
72
- `updated_at` integer NOT NULL,
73
- `permissions` text,
74
- `metadata` text,
75
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
76
- );
77
- --> statement-breakpoint
78
- CREATE TABLE `chats` (
79
- `id` text PRIMARY KEY NOT NULL,
80
- `user_id` text NOT NULL,
81
- `title` text,
82
- `type` text,
83
- `conversation` text,
84
- `created_at` integer,
85
- `updated_at` integer NOT NULL,
86
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
87
- );
88
- --> statement-breakpoint
89
- CREATE TABLE `files` (
90
- `id` text PRIMARY KEY NOT NULL,
91
- `created_at` integer NOT NULL,
92
- `updated_at` integer,
93
- `deleted_at` integer,
94
- `user_id` text,
95
- `member_id` text,
96
- `organization_id` text,
97
- `team_id` text,
98
- `bucket` text NOT NULL,
99
- `key` text NOT NULL,
100
- `original_name` text NOT NULL,
101
- `original_extension` text,
102
- `content_type` text NOT NULL,
103
- `size_bytes` integer,
104
- `etag` text,
105
- `checksum_sha256` text,
106
- `metadata` text,
107
- `status` text NOT NULL,
108
- `uploaded_at` integer,
109
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
110
- FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE set null,
111
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null,
112
- FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE set null
113
- );
114
- --> statement-breakpoint
115
- CREATE UNIQUE INDEX `files_bucket_key_unique` ON `files` (`bucket`,`key`);--> statement-breakpoint
116
- CREATE TABLE `invitations` (
117
- `id` text PRIMARY KEY NOT NULL,
118
- `organization_id` text NOT NULL,
119
- `team_id` text,
120
- `email` text NOT NULL,
121
- `role` text,
122
- `status` text NOT NULL,
123
- `created_at` integer NOT NULL,
124
- `expires_at` integer NOT NULL,
125
- `inviter_id` text NOT NULL,
126
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE no action,
127
- FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE no action,
128
- FOREIGN KEY (`inviter_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
129
- );
130
- --> statement-breakpoint
131
- CREATE TABLE `members` (
132
- `id` text PRIMARY KEY NOT NULL,
133
- `organization_id` text NOT NULL,
134
- `user_id` text NOT NULL,
135
- `name` text DEFAULT '' NOT NULL,
136
- `image` text,
137
- `role` text NOT NULL,
138
- `created_at` integer NOT NULL,
139
- `deleted_at` integer,
140
- `preferences` text DEFAULT '{}',
141
- `metadata` text DEFAULT '{}',
142
- `onboarding` integer,
143
- `flags` text DEFAULT '[]',
144
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE no action,
145
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
146
- );
147
- --> statement-breakpoint
148
- CREATE TABLE `notification_devices` (
149
- `id` text PRIMARY KEY NOT NULL,
150
- `user_id` text NOT NULL,
151
- `platform` text NOT NULL,
152
- `endpoint` text,
153
- `subscription` text,
154
- `token` text,
155
- `label` text,
156
- `enabled` integer DEFAULT true NOT NULL,
157
- `created_at` integer NOT NULL,
158
- `updated_at` integer NOT NULL,
159
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
160
- );
161
- --> statement-breakpoint
162
- CREATE UNIQUE INDEX `notification_devices_endpoint_unique` ON `notification_devices` (`endpoint`);--> statement-breakpoint
163
- CREATE UNIQUE INDEX `notification_devices_token_unique` ON `notification_devices` (`token`);--> statement-breakpoint
164
- CREATE TABLE `notification_preferences` (
165
- `id` text PRIMARY KEY NOT NULL,
166
- `member_id` text NOT NULL,
167
- `kind` text NOT NULL,
168
- `channel` text NOT NULL,
169
- `created_at` integer NOT NULL,
170
- `updated_at` integer NOT NULL,
171
- FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE cascade
172
- );
173
- --> statement-breakpoint
174
- CREATE UNIQUE INDEX `notification_preferences_member_kind_channel_unique` ON `notification_preferences` (`member_id`,`kind`,`channel`);--> statement-breakpoint
175
- CREATE TABLE `notification_send_logs` (
176
- `id` text PRIMARY KEY NOT NULL,
177
- `batch_id` text NOT NULL,
178
- `notification_id` text NOT NULL,
179
- `user_id` text NOT NULL,
180
- `device_id` text,
181
- `channel` text NOT NULL,
182
- `provider` text,
183
- `title` text NOT NULL,
184
- `body` text NOT NULL,
185
- `data` text,
186
- `status` text NOT NULL,
187
- `error` text,
188
- `job_id` text,
189
- `created_at` integer NOT NULL,
190
- `updated_at` integer NOT NULL,
191
- FOREIGN KEY (`notification_id`) REFERENCES `notifications`(`id`) ON UPDATE no action ON DELETE cascade,
192
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
193
- FOREIGN KEY (`device_id`) REFERENCES `notification_devices`(`id`) ON UPDATE no action ON DELETE set null
194
- );
195
- --> statement-breakpoint
196
- CREATE TABLE `notifications` (
197
- `id` text PRIMARY KEY NOT NULL,
198
- `member_id` text NOT NULL,
199
- `user_id` text NOT NULL,
200
- `kind` text NOT NULL,
201
- `title` text NOT NULL,
202
- `body` text NOT NULL,
203
- `data` text,
204
- `visible_in_inbox` integer DEFAULT false NOT NULL,
205
- `armed_channels` text DEFAULT '[]' NOT NULL,
206
- `web_pushed_at` integer,
207
- `mobile_pushed_at` integer,
208
- `emailed_at` integer,
209
- `read_at` integer,
210
- `created_at` integer NOT NULL,
211
- `updated_at` integer NOT NULL,
212
- FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE cascade,
213
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
214
- );
215
- --> statement-breakpoint
216
- CREATE TABLE `organizations` (
217
- `id` text PRIMARY KEY NOT NULL,
218
- `name` text NOT NULL,
219
- `slug` text,
220
- `logo` text,
221
- `type` text,
222
- `parent_id` text,
223
- `created_at` integer NOT NULL,
224
- `onboarding` integer,
225
- `preferences` text DEFAULT '{}',
226
- `metadata` text DEFAULT '{}',
227
- `flags` text DEFAULT '[]',
228
- `locale` text,
229
- FOREIGN KEY (`parent_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null
230
- );
231
- --> statement-breakpoint
232
- CREATE UNIQUE INDEX `organizations_slug_unique` ON `organizations` (`slug`);--> statement-breakpoint
233
- CREATE TABLE `posts` (
234
- `id` text PRIMARY KEY NOT NULL,
235
- `author_user_id` text,
236
- `member_id` text,
237
- `organization_id` text,
238
- `team_id` text,
239
- `title` text NOT NULL,
240
- `slug` text NOT NULL,
241
- `excerpt` text,
242
- `content` text NOT NULL,
243
- `status` text DEFAULT 'draft' NOT NULL,
244
- `published_at` integer,
245
- `created_at` integer NOT NULL,
246
- `updated_at` integer,
247
- `deleted_at` integer,
248
- FOREIGN KEY (`author_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
249
- FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE set null,
250
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null,
251
- FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE set null
252
- );
253
- --> statement-breakpoint
254
- CREATE UNIQUE INDEX `posts_slug_unique` ON `posts` (`slug`);--> statement-breakpoint
255
- CREATE TABLE `sessions` (
256
- `id` text PRIMARY KEY NOT NULL,
257
- `expires_at` integer NOT NULL,
258
- `token` text NOT NULL,
259
- `created_at` integer NOT NULL,
260
- `updated_at` integer NOT NULL,
261
- `ip_address` text,
262
- `user_agent` text,
263
- `user_id` text NOT NULL,
264
- `impersonated_by` text,
265
- `active_organization_id` text,
266
- `active_organization_member_id` text,
267
- `active_organization_role` text,
268
- `active_organization_type` text,
269
- `active_team_id` text,
270
- `active_team_role` text,
271
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
272
- );
273
- --> statement-breakpoint
274
- CREATE UNIQUE INDEX `sessions_token_unique` ON `sessions` (`token`);--> statement-breakpoint
275
- CREATE TABLE `teammembers` (
276
- `id` text PRIMARY KEY NOT NULL,
277
- `team_id` text NOT NULL,
278
- `user_id` text NOT NULL,
279
- `role` text NOT NULL,
280
- `created_at` integer NOT NULL,
281
- FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE no action,
282
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
283
- );
284
- --> statement-breakpoint
285
- CREATE TABLE `teams` (
286
- `id` text PRIMARY KEY NOT NULL,
287
- `name` text NOT NULL,
288
- `organization_id` text NOT NULL,
289
- `created_at` integer NOT NULL,
290
- `updated_at` integer,
291
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE no action
292
- );
293
- --> statement-breakpoint
294
- CREATE TABLE `users` (
295
- `id` text PRIMARY KEY NOT NULL,
296
- `name` text NOT NULL,
297
- `email` text NOT NULL,
298
- `email_verified` integer NOT NULL,
299
- `image` text,
300
- `created_at` integer NOT NULL,
301
- `updated_at` integer NOT NULL,
302
- `role` text,
303
- `banned` integer,
304
- `ban_reason` text,
305
- `ban_expires` integer,
306
- `stripe_customer_id` text,
307
- `payment_customer_id` text,
308
- `payment_plan_tier` text,
309
- `payment_plan_expires_at` integer,
310
- `preferences` text DEFAULT '{}',
311
- `metadata` text DEFAULT '{}',
312
- `onboarding` integer,
313
- `flags` text DEFAULT '[]',
314
- `locale` text
315
- );
316
- --> statement-breakpoint
317
- CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
318
- CREATE UNIQUE INDEX `users_stripe_customer_id_unique` ON `users` (`stripe_customer_id`);--> statement-breakpoint
319
- CREATE UNIQUE INDEX `users_payment_customer_id_unique` ON `users` (`payment_customer_id`);--> statement-breakpoint
320
- CREATE TABLE `verifications` (
321
- `id` text PRIMARY KEY NOT NULL,
322
- `identifier` text NOT NULL,
323
- `value` text NOT NULL,
324
- `expires_at` integer NOT NULL,
325
- `created_at` integer,
326
- `updated_at` integer
327
- );
328
- --> statement-breakpoint
329
- CREATE TABLE `waitlist` (
330
- `id` text PRIMARY KEY NOT NULL,
331
- `name` text,
332
- `email` text,
333
- `created_at` integer NOT NULL,
334
- `updated_at` integer,
335
- `status` text DEFAULT 'WAITLIST' NOT NULL,
336
- `type` text DEFAULT 'WAITLIST' NOT NULL,
337
- `code` text,
338
- `expires_at` integer,
339
- `user_id` text,
340
- `claim_user_id` text,
341
- `claimed_at` integer,
342
- `claimed_email` text,
343
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
344
- FOREIGN KEY (`claim_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
345
- );
346
- --> statement-breakpoint
347
- CREATE TABLE `workflows` (
348
- `id` text PRIMARY KEY NOT NULL,
349
- `user_id` text,
350
- `job_id` text NOT NULL,
351
- `job_name` text NOT NULL,
352
- `queue_name` text NOT NULL,
353
- `timeout` integer,
354
- `tags` text,
355
- `input` text,
356
- `output` text,
357
- `status` text NOT NULL,
358
- `error` text,
359
- `retries` integer DEFAULT 0 NOT NULL,
360
- `finished_at` integer,
361
- `processed_at` integer,
362
- `created_at` integer NOT NULL,
363
- `updated_at` integer NOT NULL,
364
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
365
- );
366
- --> statement-breakpoint
1
+ CREATE TABLE `account_claim_magic_links` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `claim_id` text NOT NULL,
4
+ `user_id` text NOT NULL,
5
+ `email` text NOT NULL,
6
+ `token` text NOT NULL,
7
+ `url` text NOT NULL,
8
+ `expires_at` integer,
9
+ `created_at` integer NOT NULL,
10
+ FOREIGN KEY (`claim_id`) REFERENCES `waitlist`(`id`) ON UPDATE no action ON DELETE cascade,
11
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE TABLE `accounts` (
15
+ `id` text PRIMARY KEY NOT NULL,
16
+ `account_id` text NOT NULL,
17
+ `provider_id` text NOT NULL,
18
+ `user_id` text NOT NULL,
19
+ `access_token` text,
20
+ `refresh_token` text,
21
+ `id_token` text,
22
+ `access_token_expires_at` integer,
23
+ `refresh_token_expires_at` integer,
24
+ `scope` text,
25
+ `password` text,
26
+ `created_at` integer NOT NULL,
27
+ `updated_at` integer NOT NULL,
28
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
29
+ );
30
+ --> statement-breakpoint
31
+ CREATE TABLE `ai_usage` (
32
+ `id` text PRIMARY KEY NOT NULL,
33
+ `user_id` text,
34
+ `member_id` text,
35
+ `team_id` text,
36
+ `organization_id` text,
37
+ `feature` text NOT NULL,
38
+ `provider` text NOT NULL,
39
+ `model` text NOT NULL,
40
+ `input_tokens` integer,
41
+ `output_tokens` integer,
42
+ `total_tokens` integer,
43
+ `cost` real,
44
+ `trace_id` text,
45
+ `created_at` integer NOT NULL,
46
+ `metadata` text,
47
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
48
+ FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE set null,
49
+ FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE set null,
50
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null
51
+ );
52
+ --> statement-breakpoint
53
+ CREATE TABLE `apikeys` (
54
+ `id` text PRIMARY KEY NOT NULL,
55
+ `name` text,
56
+ `start` text,
57
+ `prefix` text,
58
+ `key` text NOT NULL,
59
+ `user_id` text NOT NULL,
60
+ `refill_interval` integer,
61
+ `refill_amount` integer,
62
+ `last_refill_at` integer,
63
+ `enabled` integer NOT NULL,
64
+ `rate_limit_enabled` integer NOT NULL,
65
+ `rate_limit_time_window` integer,
66
+ `rate_limit_max` integer,
67
+ `request_count` integer NOT NULL,
68
+ `remaining` integer,
69
+ `last_request` integer,
70
+ `expires_at` integer,
71
+ `created_at` integer NOT NULL,
72
+ `updated_at` integer NOT NULL,
73
+ `permissions` text,
74
+ `metadata` text,
75
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
76
+ );
77
+ --> statement-breakpoint
78
+ CREATE TABLE `chats` (
79
+ `id` text PRIMARY KEY NOT NULL,
80
+ `user_id` text NOT NULL,
81
+ `title` text,
82
+ `type` text,
83
+ `conversation` text,
84
+ `created_at` integer,
85
+ `updated_at` integer NOT NULL,
86
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
87
+ );
88
+ --> statement-breakpoint
89
+ CREATE TABLE `files` (
90
+ `id` text PRIMARY KEY NOT NULL,
91
+ `created_at` integer NOT NULL,
92
+ `updated_at` integer,
93
+ `deleted_at` integer,
94
+ `user_id` text,
95
+ `member_id` text,
96
+ `organization_id` text,
97
+ `team_id` text,
98
+ `bucket` text NOT NULL,
99
+ `key` text NOT NULL,
100
+ `original_name` text NOT NULL,
101
+ `original_extension` text,
102
+ `content_type` text NOT NULL,
103
+ `size_bytes` integer,
104
+ `etag` text,
105
+ `checksum_sha256` text,
106
+ `metadata` text,
107
+ `status` text NOT NULL,
108
+ `uploaded_at` integer,
109
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
110
+ FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE set null,
111
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null,
112
+ FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE set null
113
+ );
114
+ --> statement-breakpoint
115
+ CREATE UNIQUE INDEX `files_bucket_key_unique` ON `files` (`bucket`,`key`);--> statement-breakpoint
116
+ CREATE TABLE `invitations` (
117
+ `id` text PRIMARY KEY NOT NULL,
118
+ `organization_id` text NOT NULL,
119
+ `team_id` text,
120
+ `email` text NOT NULL,
121
+ `role` text,
122
+ `status` text NOT NULL,
123
+ `created_at` integer NOT NULL,
124
+ `expires_at` integer NOT NULL,
125
+ `inviter_id` text NOT NULL,
126
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE no action,
127
+ FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE no action,
128
+ FOREIGN KEY (`inviter_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
129
+ );
130
+ --> statement-breakpoint
131
+ CREATE TABLE `members` (
132
+ `id` text PRIMARY KEY NOT NULL,
133
+ `organization_id` text NOT NULL,
134
+ `user_id` text NOT NULL,
135
+ `name` text DEFAULT '' NOT NULL,
136
+ `image` text,
137
+ `role` text NOT NULL,
138
+ `created_at` integer NOT NULL,
139
+ `deleted_at` integer,
140
+ `preferences` text DEFAULT '{}',
141
+ `metadata` text DEFAULT '{}',
142
+ `onboarding` integer,
143
+ `flags` text DEFAULT '[]',
144
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE no action,
145
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
146
+ );
147
+ --> statement-breakpoint
148
+ CREATE TABLE `notification_devices` (
149
+ `id` text PRIMARY KEY NOT NULL,
150
+ `user_id` text NOT NULL,
151
+ `platform` text NOT NULL,
152
+ `endpoint` text,
153
+ `subscription` text,
154
+ `token` text,
155
+ `label` text,
156
+ `enabled` integer DEFAULT true NOT NULL,
157
+ `created_at` integer NOT NULL,
158
+ `updated_at` integer NOT NULL,
159
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
160
+ );
161
+ --> statement-breakpoint
162
+ CREATE UNIQUE INDEX `notification_devices_endpoint_unique` ON `notification_devices` (`endpoint`);--> statement-breakpoint
163
+ CREATE UNIQUE INDEX `notification_devices_token_unique` ON `notification_devices` (`token`);--> statement-breakpoint
164
+ CREATE TABLE `notification_preferences` (
165
+ `id` text PRIMARY KEY NOT NULL,
166
+ `member_id` text NOT NULL,
167
+ `kind` text NOT NULL,
168
+ `channel` text NOT NULL,
169
+ `created_at` integer NOT NULL,
170
+ `updated_at` integer NOT NULL,
171
+ FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE cascade
172
+ );
173
+ --> statement-breakpoint
174
+ CREATE UNIQUE INDEX `notification_preferences_member_kind_channel_unique` ON `notification_preferences` (`member_id`,`kind`,`channel`);--> statement-breakpoint
175
+ CREATE TABLE `notification_send_logs` (
176
+ `id` text PRIMARY KEY NOT NULL,
177
+ `batch_id` text NOT NULL,
178
+ `notification_id` text NOT NULL,
179
+ `user_id` text NOT NULL,
180
+ `device_id` text,
181
+ `channel` text NOT NULL,
182
+ `provider` text,
183
+ `title` text NOT NULL,
184
+ `body` text NOT NULL,
185
+ `data` text,
186
+ `status` text NOT NULL,
187
+ `error` text,
188
+ `job_id` text,
189
+ `created_at` integer NOT NULL,
190
+ `updated_at` integer NOT NULL,
191
+ FOREIGN KEY (`notification_id`) REFERENCES `notifications`(`id`) ON UPDATE no action ON DELETE cascade,
192
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
193
+ FOREIGN KEY (`device_id`) REFERENCES `notification_devices`(`id`) ON UPDATE no action ON DELETE set null
194
+ );
195
+ --> statement-breakpoint
196
+ CREATE TABLE `notifications` (
197
+ `id` text PRIMARY KEY NOT NULL,
198
+ `member_id` text NOT NULL,
199
+ `user_id` text NOT NULL,
200
+ `kind` text NOT NULL,
201
+ `title` text NOT NULL,
202
+ `body` text NOT NULL,
203
+ `data` text,
204
+ `visible_in_inbox` integer DEFAULT false NOT NULL,
205
+ `armed_channels` text DEFAULT '[]' NOT NULL,
206
+ `web_pushed_at` integer,
207
+ `mobile_pushed_at` integer,
208
+ `emailed_at` integer,
209
+ `read_at` integer,
210
+ `created_at` integer NOT NULL,
211
+ `updated_at` integer NOT NULL,
212
+ FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE cascade,
213
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
214
+ );
215
+ --> statement-breakpoint
216
+ CREATE TABLE `organizations` (
217
+ `id` text PRIMARY KEY NOT NULL,
218
+ `name` text NOT NULL,
219
+ `slug` text,
220
+ `logo` text,
221
+ `type` text,
222
+ `parent_id` text,
223
+ `created_at` integer NOT NULL,
224
+ `onboarding` integer,
225
+ `preferences` text DEFAULT '{}',
226
+ `metadata` text DEFAULT '{}',
227
+ `flags` text DEFAULT '[]',
228
+ `locale` text,
229
+ FOREIGN KEY (`parent_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null
230
+ );
231
+ --> statement-breakpoint
232
+ CREATE UNIQUE INDEX `organizations_slug_unique` ON `organizations` (`slug`);--> statement-breakpoint
233
+ CREATE TABLE `posts` (
234
+ `id` text PRIMARY KEY NOT NULL,
235
+ `author_user_id` text,
236
+ `member_id` text,
237
+ `organization_id` text,
238
+ `team_id` text,
239
+ `title` text NOT NULL,
240
+ `slug` text NOT NULL,
241
+ `excerpt` text,
242
+ `content` text NOT NULL,
243
+ `status` text DEFAULT 'draft' NOT NULL,
244
+ `published_at` integer,
245
+ `created_at` integer NOT NULL,
246
+ `updated_at` integer,
247
+ `deleted_at` integer,
248
+ FOREIGN KEY (`author_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
249
+ FOREIGN KEY (`member_id`) REFERENCES `members`(`id`) ON UPDATE no action ON DELETE set null,
250
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE set null,
251
+ FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE set null
252
+ );
253
+ --> statement-breakpoint
254
+ CREATE UNIQUE INDEX `posts_slug_unique` ON `posts` (`slug`);--> statement-breakpoint
255
+ CREATE TABLE `sessions` (
256
+ `id` text PRIMARY KEY NOT NULL,
257
+ `expires_at` integer NOT NULL,
258
+ `token` text NOT NULL,
259
+ `created_at` integer NOT NULL,
260
+ `updated_at` integer NOT NULL,
261
+ `ip_address` text,
262
+ `user_agent` text,
263
+ `user_id` text NOT NULL,
264
+ `impersonated_by` text,
265
+ `active_organization_id` text,
266
+ `active_organization_member_id` text,
267
+ `active_organization_role` text,
268
+ `active_organization_type` text,
269
+ `active_team_id` text,
270
+ `active_team_role` text,
271
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
272
+ );
273
+ --> statement-breakpoint
274
+ CREATE UNIQUE INDEX `sessions_token_unique` ON `sessions` (`token`);--> statement-breakpoint
275
+ CREATE TABLE `teammembers` (
276
+ `id` text PRIMARY KEY NOT NULL,
277
+ `team_id` text NOT NULL,
278
+ `user_id` text NOT NULL,
279
+ `role` text NOT NULL,
280
+ `created_at` integer NOT NULL,
281
+ FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE no action,
282
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
283
+ );
284
+ --> statement-breakpoint
285
+ CREATE TABLE `teams` (
286
+ `id` text PRIMARY KEY NOT NULL,
287
+ `name` text NOT NULL,
288
+ `organization_id` text NOT NULL,
289
+ `created_at` integer NOT NULL,
290
+ `updated_at` integer,
291
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE no action
292
+ );
293
+ --> statement-breakpoint
294
+ CREATE TABLE `users` (
295
+ `id` text PRIMARY KEY NOT NULL,
296
+ `name` text NOT NULL,
297
+ `email` text NOT NULL,
298
+ `email_verified` integer NOT NULL,
299
+ `image` text,
300
+ `created_at` integer NOT NULL,
301
+ `updated_at` integer NOT NULL,
302
+ `role` text,
303
+ `banned` integer,
304
+ `ban_reason` text,
305
+ `ban_expires` integer,
306
+ `stripe_customer_id` text,
307
+ `payment_customer_id` text,
308
+ `payment_plan_tier` text,
309
+ `payment_plan_expires_at` integer,
310
+ `preferences` text DEFAULT '{}',
311
+ `metadata` text DEFAULT '{}',
312
+ `onboarding` integer,
313
+ `flags` text DEFAULT '[]',
314
+ `locale` text
315
+ );
316
+ --> statement-breakpoint
317
+ CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
318
+ CREATE UNIQUE INDEX `users_stripe_customer_id_unique` ON `users` (`stripe_customer_id`);--> statement-breakpoint
319
+ CREATE UNIQUE INDEX `users_payment_customer_id_unique` ON `users` (`payment_customer_id`);--> statement-breakpoint
320
+ CREATE TABLE `verifications` (
321
+ `id` text PRIMARY KEY NOT NULL,
322
+ `identifier` text NOT NULL,
323
+ `value` text NOT NULL,
324
+ `expires_at` integer NOT NULL,
325
+ `created_at` integer,
326
+ `updated_at` integer
327
+ );
328
+ --> statement-breakpoint
329
+ CREATE TABLE `waitlist` (
330
+ `id` text PRIMARY KEY NOT NULL,
331
+ `name` text,
332
+ `email` text,
333
+ `created_at` integer NOT NULL,
334
+ `updated_at` integer,
335
+ `status` text DEFAULT 'WAITLIST' NOT NULL,
336
+ `type` text DEFAULT 'WAITLIST' NOT NULL,
337
+ `code` text,
338
+ `expires_at` integer,
339
+ `user_id` text,
340
+ `claim_user_id` text,
341
+ `claimed_at` integer,
342
+ `claimed_email` text,
343
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
344
+ FOREIGN KEY (`claim_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
345
+ );
346
+ --> statement-breakpoint
347
+ CREATE TABLE `workflows` (
348
+ `id` text PRIMARY KEY NOT NULL,
349
+ `user_id` text,
350
+ `job_id` text NOT NULL,
351
+ `job_name` text NOT NULL,
352
+ `queue_name` text NOT NULL,
353
+ `timeout` integer,
354
+ `tags` text,
355
+ `input` text,
356
+ `output` text,
357
+ `status` text NOT NULL,
358
+ `error` text,
359
+ `retries` integer DEFAULT 0 NOT NULL,
360
+ `finished_at` integer,
361
+ `processed_at` integer,
362
+ `created_at` integer NOT NULL,
363
+ `updated_at` integer NOT NULL,
364
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
365
+ );
366
+ --> statement-breakpoint
367
367
  CREATE UNIQUE INDEX `workflows_job_id_unique` ON `workflows` (`job_id`);