@zodic/shared 0.0.18 → 0.0.20

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.
@@ -0,0 +1,32 @@
1
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
2
+ CREATE TABLE `__new_user_artifacts` (
3
+ `id` text PRIMARY KEY NOT NULL,
4
+ `user_id` text NOT NULL,
5
+ `user_concept_id` text NOT NULL,
6
+ `artifact_id` text NOT NULL,
7
+ `gender` text NOT NULL,
8
+ `archetype_index` text NOT NULL,
9
+ `post_image_id` text,
10
+ `reel_image_id` text,
11
+ `post_image_url` text,
12
+ `reel_image_url` text,
13
+ `post_generation_id` text,
14
+ `reel_generation_id` text,
15
+ `status` text DEFAULT 'pending' NOT NULL,
16
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP,
17
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP,
18
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
19
+ FOREIGN KEY (`user_concept_id`) REFERENCES `user_concepts`(`id`) ON UPDATE no action ON DELETE cascade,
20
+ FOREIGN KEY (`artifact_id`) REFERENCES `artifacts`(`id`) ON UPDATE no action ON DELETE cascade
21
+ );
22
+ --> statement-breakpoint
23
+ INSERT INTO `__new_user_artifacts`("id", "user_id", "user_concept_id", "artifact_id", "gender", "archetype_index", "post_image_id", "reel_image_id", "post_image_url", "reel_image_url", "post_generation_id", "reel_generation_id", "status", "created_at", "updated_at") SELECT "id", "user_id", "user_concept_id", "artifact_id", "gender", "archetype_index", "post_image_id", "reel_image_id", "post_image_url", "reel_image_url", "post_generation_id", "reel_generation_id", "status", "created_at", "updated_at" FROM `user_artifacts`;--> statement-breakpoint
24
+ DROP TABLE `user_artifacts`;--> statement-breakpoint
25
+ ALTER TABLE `__new_user_artifacts` RENAME TO `user_artifacts`;--> statement-breakpoint
26
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
27
+ CREATE INDEX `user_artifacts_user_id_idx` ON `user_artifacts` (`user_id`);--> statement-breakpoint
28
+ CREATE INDEX `user_artifacts_artifact_id_idx` ON `user_artifacts` (`artifact_id`);--> statement-breakpoint
29
+ CREATE INDEX `user_artifacts_status_idx` ON `user_artifacts` (`status`);--> statement-breakpoint
30
+ ALTER TABLE `generations` ADD `gender` text;--> statement-breakpoint
31
+ ALTER TABLE `users` ADD `updated_at` text DEFAULT CURRENT_TIMESTAMP;--> statement-breakpoint
32
+ CREATE UNIQUE INDEX `artifacts_slug_unique` ON `artifacts` (`slug`);
@@ -0,0 +1,130 @@
1
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
2
+ CREATE TABLE `__new_artifact_faceswap` (
3
+ `id` text PRIMARY KEY NOT NULL,
4
+ `user_artifact_id` text NOT NULL,
5
+ `face_swapped_image_url` text,
6
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
7
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
8
+ FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade
9
+ );
10
+ --> statement-breakpoint
11
+ INSERT INTO `__new_artifact_faceswap`("id", "user_artifact_id", "face_swapped_image_url", "created_at", "updated_at") SELECT "id", "user_artifact_id", "face_swapped_image_url", "created_at", "updated_at" FROM `artifact_faceswap`;--> statement-breakpoint
12
+ DROP TABLE `artifact_faceswap`;--> statement-breakpoint
13
+ ALTER TABLE `__new_artifact_faceswap` RENAME TO `artifact_faceswap`;--> statement-breakpoint
14
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
15
+ CREATE TABLE `__new_credits_transactions` (
16
+ `id` text PRIMARY KEY NOT NULL,
17
+ `user_id` text NOT NULL,
18
+ `type` text NOT NULL,
19
+ `amount` integer NOT NULL,
20
+ `description` text,
21
+ `product_type` text,
22
+ `product_id` text,
23
+ `payment_id` text,
24
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
25
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
26
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
27
+ );
28
+ --> statement-breakpoint
29
+ INSERT INTO `__new_credits_transactions`("id", "user_id", "type", "amount", "description", "product_type", "product_id", "payment_id", "created_at", "updated_at") SELECT "id", "user_id", "type", "amount", "description", "product_type", "product_id", "payment_id", "created_at", "updated_at" FROM `credits_transactions`;--> statement-breakpoint
30
+ DROP TABLE `credits_transactions`;--> statement-breakpoint
31
+ ALTER TABLE `__new_credits_transactions` RENAME TO `credits_transactions`;--> statement-breakpoint
32
+ CREATE INDEX `credits_transactions_user_id_idx` ON `credits_transactions` (`user_id`);--> statement-breakpoint
33
+ CREATE TABLE `__new_generations` (
34
+ `id` text PRIMARY KEY NOT NULL,
35
+ `user_id` text NOT NULL,
36
+ `artifact_id` text,
37
+ `user_artifact_id` text,
38
+ `gender` text,
39
+ `concept_combination_id` text,
40
+ `type` text NOT NULL,
41
+ `status` text DEFAULT 'pending' NOT NULL,
42
+ `url` text,
43
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
44
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
45
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
46
+ FOREIGN KEY (`artifact_id`) REFERENCES `artifacts`(`id`) ON UPDATE no action ON DELETE cascade,
47
+ FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade,
48
+ FOREIGN KEY (`concept_combination_id`) REFERENCES `concept_combinations`(`id`) ON UPDATE no action ON DELETE cascade
49
+ );
50
+ --> statement-breakpoint
51
+ INSERT INTO `__new_generations`("id", "user_id", "artifact_id", "user_artifact_id", "gender", "concept_combination_id", "type", "status", "url", "created_at", "updated_at") SELECT "id", "user_id", "artifact_id", "user_artifact_id", "gender", "concept_combination_id", "type", "status", "url", "created_at", "updated_at" FROM `generations`;--> statement-breakpoint
52
+ DROP TABLE `generations`;--> statement-breakpoint
53
+ ALTER TABLE `__new_generations` RENAME TO `generations`;--> statement-breakpoint
54
+ CREATE INDEX `generations_user_id_idx` ON `generations` (`user_id`);--> statement-breakpoint
55
+ CREATE INDEX `generations_concept_combination_id_idx` ON `generations` (`concept_combination_id`);--> statement-breakpoint
56
+ CREATE TABLE `__new_user_artifacts` (
57
+ `id` text PRIMARY KEY NOT NULL,
58
+ `user_id` text NOT NULL,
59
+ `user_concept_id` text NOT NULL,
60
+ `artifact_id` text NOT NULL,
61
+ `gender` text NOT NULL,
62
+ `archetype_index` text NOT NULL,
63
+ `post_image_id` text,
64
+ `reel_image_id` text,
65
+ `post_image_url` text,
66
+ `reel_image_url` text,
67
+ `post_generation_id` text,
68
+ `reel_generation_id` text,
69
+ `status` text DEFAULT 'pending' NOT NULL,
70
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
71
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
72
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
73
+ FOREIGN KEY (`user_concept_id`) REFERENCES `user_concepts`(`id`) ON UPDATE no action ON DELETE cascade,
74
+ FOREIGN KEY (`artifact_id`) REFERENCES `artifacts`(`id`) ON UPDATE no action ON DELETE cascade
75
+ );
76
+ --> statement-breakpoint
77
+ INSERT INTO `__new_user_artifacts`("id", "user_id", "user_concept_id", "artifact_id", "gender", "archetype_index", "post_image_id", "reel_image_id", "post_image_url", "reel_image_url", "post_generation_id", "reel_generation_id", "status", "created_at", "updated_at") SELECT "id", "user_id", "user_concept_id", "artifact_id", "gender", "archetype_index", "post_image_id", "reel_image_id", "post_image_url", "reel_image_url", "post_generation_id", "reel_generation_id", "status", "created_at", "updated_at" FROM `user_artifacts`;--> statement-breakpoint
78
+ DROP TABLE `user_artifacts`;--> statement-breakpoint
79
+ ALTER TABLE `__new_user_artifacts` RENAME TO `user_artifacts`;--> statement-breakpoint
80
+ CREATE INDEX `user_artifacts_user_id_idx` ON `user_artifacts` (`user_id`);--> statement-breakpoint
81
+ CREATE INDEX `user_artifacts_artifact_id_idx` ON `user_artifacts` (`artifact_id`);--> statement-breakpoint
82
+ CREATE INDEX `user_artifacts_status_idx` ON `user_artifacts` (`status`);--> statement-breakpoint
83
+ CREATE TABLE `__new_user_concepts` (
84
+ `id` text PRIMARY KEY NOT NULL,
85
+ `user_id` text NOT NULL,
86
+ `concept_id` text NOT NULL,
87
+ `concept_combination_id` text NOT NULL,
88
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
89
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
90
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
91
+ FOREIGN KEY (`concept_id`) REFERENCES `concepts`(`id`) ON UPDATE no action ON DELETE cascade,
92
+ FOREIGN KEY (`concept_combination_id`) REFERENCES `concept_combinations`(`id`) ON UPDATE no action ON DELETE cascade
93
+ );
94
+ --> statement-breakpoint
95
+ INSERT INTO `__new_user_concepts`("id", "user_id", "concept_id", "concept_combination_id", "created_at", "updated_at") SELECT "id", "user_id", "concept_id", "concept_combination_id", "created_at", "updated_at" FROM `user_concepts`;--> statement-breakpoint
96
+ DROP TABLE `user_concepts`;--> statement-breakpoint
97
+ ALTER TABLE `__new_user_concepts` RENAME TO `user_concepts`;--> statement-breakpoint
98
+ CREATE INDEX `user_concepts_user_id_idx` ON `user_concepts` (`user_id`);--> statement-breakpoint
99
+ CREATE INDEX `user_concepts_concept_id_idx` ON `user_concepts` (`concept_id`);--> statement-breakpoint
100
+ CREATE TABLE `__new_users` (
101
+ `id` text PRIMARY KEY NOT NULL,
102
+ `email` text NOT NULL,
103
+ `name` text NOT NULL,
104
+ `profile_image` text,
105
+ `user_photo_id` text,
106
+ `user_photo_url` text,
107
+ `gender` text,
108
+ `day` integer,
109
+ `month` integer,
110
+ `year` integer,
111
+ `hour` integer,
112
+ `min` integer,
113
+ `latitude` real,
114
+ `longitude` real,
115
+ `tzone` real,
116
+ `instagram_username` text,
117
+ `credits_balance` integer,
118
+ `total_credits_earned` integer DEFAULT 0,
119
+ `last_transaction_at` integer,
120
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
121
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
122
+ );
123
+ --> statement-breakpoint
124
+ INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "day", "month", "year", "hour", "min", "latitude", "longitude", "tzone", "instagram_username", "credits_balance", "total_credits_earned", "last_transaction_at", "created_at", "updated_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "day", "month", "year", "hour", "min", "latitude", "longitude", "tzone", "instagram_username", "credits_balance", "total_credits_earned", "last_transaction_at", "created_at", "updated_at" FROM `users`;--> statement-breakpoint
125
+ DROP TABLE `users`;--> statement-breakpoint
126
+ ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
127
+ CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
128
+ CREATE INDEX `users_email_idx` ON `users` (`email`);--> statement-breakpoint
129
+ ALTER TABLE `artifact_video_generation` ADD `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL;--> statement-breakpoint
130
+ ALTER TABLE `artifact_video_generation` ADD `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL;