@zodic/shared 0.0.391 → 0.0.393
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.
- package/db/migrations/0019_abandoned_orphan.sql +59 -0
- package/db/migrations/meta/0019_snapshot.json +3244 -0
- package/db/migrations/meta/_journal.json +7 -0
- package/db/schema.ts +79 -4
- package/package.json +1 -1
- package/types/scopes/generic.ts +8 -0
- package/utils/index.ts +0 -2
- package/utils/productLabels.ts +46 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
CREATE TABLE `asaas_events` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`asaas_event_id` text NOT NULL,
|
|
4
|
+
`payload` text NOT NULL,
|
|
5
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
6
|
+
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
7
|
+
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE UNIQUE INDEX `asaas_events_asaas_event_id_unique` ON `asaas_events` (`asaas_event_id`);--> statement-breakpoint
|
|
11
|
+
CREATE INDEX `asaas_events_asaas_event_id_idx` ON `asaas_events` (`asaas_event_id`);--> statement-breakpoint
|
|
12
|
+
CREATE TABLE `payments` (
|
|
13
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
14
|
+
`user_id` text NOT NULL,
|
|
15
|
+
`checkout_id` text NOT NULL,
|
|
16
|
+
`amount` real NOT NULL,
|
|
17
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
18
|
+
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
19
|
+
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
20
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
21
|
+
);
|
|
22
|
+
--> statement-breakpoint
|
|
23
|
+
CREATE UNIQUE INDEX `payments_checkout_id_unique` ON `payments` (`checkout_id`);--> statement-breakpoint
|
|
24
|
+
CREATE INDEX `payments_user_id_idx` ON `payments` (`user_id`);--> statement-breakpoint
|
|
25
|
+
CREATE INDEX `payments_checkout_id_idx` ON `payments` (`checkout_id`);--> statement-breakpoint
|
|
26
|
+
CREATE TABLE `products` (
|
|
27
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
28
|
+
`slug` text NOT NULL,
|
|
29
|
+
`price` real NOT NULL,
|
|
30
|
+
`image_url` text,
|
|
31
|
+
`image_base64` text,
|
|
32
|
+
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
33
|
+
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
34
|
+
);
|
|
35
|
+
--> statement-breakpoint
|
|
36
|
+
CREATE UNIQUE INDEX `products_slug_unique` ON `products` (`slug`);--> statement-breakpoint
|
|
37
|
+
CREATE INDEX `products_slug_idx` ON `products` (`slug`);--> statement-breakpoint
|
|
38
|
+
CREATE TABLE `user_products` (
|
|
39
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
40
|
+
`user_id` text NOT NULL,
|
|
41
|
+
`product_id` text NOT NULL,
|
|
42
|
+
`checkout_id` text,
|
|
43
|
+
`payment_id` text,
|
|
44
|
+
`status` text DEFAULT 'locked' NOT NULL,
|
|
45
|
+
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
46
|
+
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
47
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
48
|
+
FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
49
|
+
FOREIGN KEY (`payment_id`) REFERENCES `payments`(`id`) ON UPDATE no action ON DELETE set null
|
|
50
|
+
);
|
|
51
|
+
--> statement-breakpoint
|
|
52
|
+
CREATE INDEX `user_products_user_id_idx` ON `user_products` (`user_id`);--> statement-breakpoint
|
|
53
|
+
CREATE INDEX `user_products_product_id_idx` ON `user_products` (`product_id`);--> statement-breakpoint
|
|
54
|
+
CREATE INDEX `user_products_payment_id_idx` ON `user_products` (`payment_id`);--> statement-breakpoint
|
|
55
|
+
CREATE INDEX `user_products_checkout_id_idx` ON `user_products` (`checkout_id`);--> statement-breakpoint
|
|
56
|
+
ALTER TABLE `user_artifacts` ADD `upscaled_image` text;--> statement-breakpoint
|
|
57
|
+
ALTER TABLE `user_artifacts` ADD `framed_image` text;--> statement-breakpoint
|
|
58
|
+
ALTER TABLE `users` ADD `customer_id` text;--> statement-breakpoint
|
|
59
|
+
CREATE INDEX `users_customer_id_idx` ON `users` (`customer_id`);
|