@zodic/shared 0.0.26 → 0.0.27

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.
@@ -1,3 +1,26 @@
1
+ CREATE TABLE `artifact_faceswap` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `user_artifact_id` text NOT NULL,
4
+ `face_swapped_image_url` text,
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
+ FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE TABLE `artifact_video_generation` (
12
+ `id` text PRIMARY KEY NOT NULL,
13
+ `user_artifact_id` text NOT NULL,
14
+ `video_status` text DEFAULT 'pending',
15
+ `video_url` text,
16
+ `description` text,
17
+ `duration` integer,
18
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
19
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
20
+ FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE INDEX `artifact_video_generation_status_idx` ON `artifact_video_generation` (`video_status`);--> statement-breakpoint
1
24
  CREATE TABLE `artifacts` (
2
25
  `id` text PRIMARY KEY NOT NULL,
3
26
  `name` text NOT NULL,
@@ -10,7 +33,22 @@ CREATE TABLE `artifacts` (
10
33
  FOREIGN KEY (`concept_id`) REFERENCES `concepts`(`id`) ON UPDATE no action ON DELETE cascade
11
34
  );
12
35
  --> statement-breakpoint
36
+ CREATE UNIQUE INDEX `artifacts_slug_unique` ON `artifacts` (`slug`);--> statement-breakpoint
13
37
  CREATE INDEX `artifacts_concept_id_idx` ON `artifacts` (`concept_id`);--> statement-breakpoint
38
+ CREATE TABLE `astro_aspects` (
39
+ `id` text PRIMARY KEY NOT NULL,
40
+ `user_id` text NOT NULL,
41
+ `aspecting_planet` text NOT NULL,
42
+ `aspected_planet` text NOT NULL,
43
+ `aspecting_planet_id` integer NOT NULL,
44
+ `aspected_planet_id` integer NOT NULL,
45
+ `type` text NOT NULL,
46
+ `orb` real NOT NULL,
47
+ `diff` real NOT NULL,
48
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
49
+ );
50
+ --> statement-breakpoint
51
+ CREATE INDEX `astro_aspects_user_id_idx` ON `astro_aspects` (`user_id`);--> statement-breakpoint
14
52
  CREATE TABLE `astro_features` (
15
53
  `id` text PRIMARY KEY NOT NULL,
16
54
  `user_id` text NOT NULL,
@@ -18,7 +56,7 @@ CREATE TABLE `astro_features` (
18
56
  `name` text NOT NULL,
19
57
  `description` text,
20
58
  `percentage` real,
21
- `order` integer NOT NULL,
59
+ `order` integer,
22
60
  `prominent_id` integer,
23
61
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
24
62
  );
@@ -82,22 +120,25 @@ CREATE TABLE `credits_transactions` (
82
120
  `product_type` text,
83
121
  `product_id` text,
84
122
  `payment_id` text,
85
- `created_at` integer DEFAULT CURRENT_TIMESTAMP,
123
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
124
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
86
125
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
87
126
  );
88
127
  --> statement-breakpoint
89
128
  CREATE INDEX `credits_transactions_user_id_idx` ON `credits_transactions` (`user_id`);--> statement-breakpoint
90
129
  CREATE TABLE `generations` (
91
130
  `id` text PRIMARY KEY NOT NULL,
92
- `user_id` text NOT NULL,
131
+ `user_id` text,
93
132
  `artifact_id` text,
133
+ `archetype_index` integer,
94
134
  `user_artifact_id` text,
135
+ `gender` text,
95
136
  `concept_combination_id` text,
96
137
  `type` text NOT NULL,
97
138
  `status` text DEFAULT 'pending' NOT NULL,
98
139
  `url` text,
99
- `created_at` integer DEFAULT CURRENT_TIMESTAMP,
100
- `updated_at` integer DEFAULT CURRENT_TIMESTAMP,
140
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
141
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
101
142
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
102
143
  FOREIGN KEY (`artifact_id`) REFERENCES `artifacts`(`id`) ON UPDATE no action ON DELETE cascade,
103
144
  FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade,
@@ -106,12 +147,14 @@ CREATE TABLE `generations` (
106
147
  --> statement-breakpoint
107
148
  CREATE INDEX `generations_user_id_idx` ON `generations` (`user_id`);--> statement-breakpoint
108
149
  CREATE INDEX `generations_concept_combination_id_idx` ON `generations` (`concept_combination_id`);--> statement-breakpoint
150
+ CREATE INDEX `generations_archetype_index_idx` ON `generations` (`archetype_index`);--> statement-breakpoint
109
151
  CREATE TABLE `tokens` (
110
152
  `id` text PRIMARY KEY NOT NULL,
111
153
  `user_id` text NOT NULL,
112
154
  `refresh_token` text NOT NULL,
113
155
  `expires_at` text NOT NULL,
114
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
156
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
157
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
115
158
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
116
159
  );
117
160
  --> statement-breakpoint
@@ -120,17 +163,21 @@ CREATE INDEX `tokens_user_id_idx` ON `tokens` (`user_id`);--> statement-breakpoi
120
163
  CREATE TABLE `user_artifacts` (
121
164
  `id` text PRIMARY KEY NOT NULL,
122
165
  `user_id` text NOT NULL,
166
+ `user_concept_id` text NOT NULL,
123
167
  `artifact_id` text NOT NULL,
124
168
  `gender` text NOT NULL,
125
- `archetype_id` text NOT NULL,
169
+ `archetype_index` text NOT NULL,
170
+ `post_image_id` text,
171
+ `reel_image_id` text,
126
172
  `post_image_url` text,
127
173
  `reel_image_url` text,
128
174
  `post_generation_id` text,
129
175
  `reel_generation_id` text,
130
176
  `status` text DEFAULT 'pending' NOT NULL,
131
- `created_at` integer DEFAULT CURRENT_TIMESTAMP,
132
- `updated_at` integer DEFAULT CURRENT_TIMESTAMP,
177
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
178
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
133
179
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
180
+ FOREIGN KEY (`user_concept_id`) REFERENCES `user_concepts`(`id`) ON UPDATE no action ON DELETE cascade,
134
181
  FOREIGN KEY (`artifact_id`) REFERENCES `artifacts`(`id`) ON UPDATE no action ON DELETE cascade
135
182
  );
136
183
  --> statement-breakpoint
@@ -142,8 +189,8 @@ CREATE TABLE `user_concepts` (
142
189
  `user_id` text NOT NULL,
143
190
  `concept_id` text NOT NULL,
144
191
  `concept_combination_id` text NOT NULL,
145
- `created_at` integer DEFAULT CURRENT_TIMESTAMP,
146
- `updated_at` integer DEFAULT CURRENT_TIMESTAMP,
192
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
193
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
147
194
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
148
195
  FOREIGN KEY (`concept_id`) REFERENCES `concepts`(`id`) ON UPDATE no action ON DELETE cascade,
149
196
  FOREIGN KEY (`concept_combination_id`) REFERENCES `concept_combinations`(`id`) ON UPDATE no action ON DELETE cascade
@@ -159,19 +206,21 @@ CREATE TABLE `users` (
159
206
  `user_photo_id` text,
160
207
  `user_photo_url` text,
161
208
  `gender` text,
162
- `day` integer,
163
- `month` integer,
164
- `year` integer,
209
+ `day` integer NOT NULL,
210
+ `month` integer NOT NULL,
211
+ `year` integer NOT NULL,
165
212
  `hour` integer,
166
213
  `min` integer,
167
- `latitude` real,
168
- `longitude` real,
214
+ `latitude` real NOT NULL,
215
+ `longitude` real NOT NULL,
169
216
  `tzone` real,
170
217
  `instagram_username` text,
171
- `credits_balance` integer,
172
- `total_credits_earned` integer DEFAULT 0,
218
+ `tiktok_username` text,
219
+ `credits_balance` integer DEFAULT 0 NOT NULL,
220
+ `total_credits_earned` integer DEFAULT 0 NOT NULL,
173
221
  `last_transaction_at` integer,
174
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
222
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
223
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
175
224
  );
176
225
  --> statement-breakpoint
177
226
  CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
@@ -0,0 +1,20 @@
1
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
2
+ CREATE TABLE `__new_credits_transactions` (
3
+ `id` text PRIMARY KEY NOT NULL,
4
+ `user_id` text NOT NULL,
5
+ `type` text NOT NULL,
6
+ `amount` integer NOT NULL,
7
+ `description` text,
8
+ `product_type` text,
9
+ `product_id` text,
10
+ `payment_id` text NOT NULL,
11
+ `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
12
+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
13
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
14
+ );
15
+ --> statement-breakpoint
16
+ 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
17
+ DROP TABLE `credits_transactions`;--> statement-breakpoint
18
+ ALTER TABLE `__new_credits_transactions` RENAME TO `credits_transactions`;--> statement-breakpoint
19
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
20
+ CREATE INDEX `credits_transactions_user_id_idx` ON `credits_transactions` (`user_id`);