@zodic/shared 0.0.19 → 0.0.21
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/0003_cynical_frog_thor.sql +32 -0
- package/db/migrations/0004_light_masked_marvel.sql +130 -0
- package/db/migrations/0005_silky_dagger.sql +1 -0
- package/db/migrations/meta/0003_snapshot.json +1458 -0
- package/db/migrations/meta/0004_snapshot.json +1480 -0
- package/db/migrations/meta/0005_snapshot.json +1487 -0
- package/db/migrations/meta/_journal.json +21 -0
- package/db/schema.ts +17 -31
- package/package.json +3 -2
|
@@ -22,6 +22,27 @@
|
|
|
22
22
|
"when": 1737480263536,
|
|
23
23
|
"tag": "0002_condemned_turbo",
|
|
24
24
|
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "6",
|
|
29
|
+
"when": 1737649237207,
|
|
30
|
+
"tag": "0003_cynical_frog_thor",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "6",
|
|
36
|
+
"when": 1737649768416,
|
|
37
|
+
"tag": "0004_light_masked_marvel",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"idx": 5,
|
|
42
|
+
"version": "6",
|
|
43
|
+
"when": 1737650810571,
|
|
44
|
+
"tag": "0005_silky_dagger",
|
|
45
|
+
"breakpoints": true
|
|
25
46
|
}
|
|
26
47
|
]
|
|
27
48
|
}
|
package/db/schema.ts
CHANGED
|
@@ -7,6 +7,15 @@ import {
|
|
|
7
7
|
text,
|
|
8
8
|
} from 'drizzle-orm/sqlite-core';
|
|
9
9
|
|
|
10
|
+
export const timestampFields = {
|
|
11
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
12
|
+
.default(sql`CURRENT_TIMESTAMP`)
|
|
13
|
+
.notNull(),
|
|
14
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' })
|
|
15
|
+
.default(sql`CURRENT_TIMESTAMP`)
|
|
16
|
+
.notNull(),
|
|
17
|
+
};
|
|
18
|
+
|
|
10
19
|
export const users = sqliteTable(
|
|
11
20
|
'users',
|
|
12
21
|
{
|
|
@@ -30,10 +39,7 @@ export const users = sqliteTable(
|
|
|
30
39
|
credits_balance: integer('credits_balance'),
|
|
31
40
|
totalCreditsEarned: integer('total_credits_earned').default(0),
|
|
32
41
|
lastTransactionAt: integer('last_transaction_at', { mode: 'timestamp' }),
|
|
33
|
-
|
|
34
|
-
.default(sql`CURRENT_TIMESTAMP`)
|
|
35
|
-
.notNull(),
|
|
36
|
-
updatedAt: text('updated_at').default(sql`CURRENT_TIMESTAMP`),
|
|
42
|
+
...timestampFields,
|
|
37
43
|
},
|
|
38
44
|
(t) => [index('users_email_idx').on(t.email)]
|
|
39
45
|
);
|
|
@@ -51,9 +57,7 @@ export const creditsTransactions = sqliteTable(
|
|
|
51
57
|
productType: text('product_type'), // e.g., "concept", "artifact", "astrology_report"
|
|
52
58
|
productId: text('product_id'), // Corresponding ID for the product (concept_id, artifact_id, etc.)
|
|
53
59
|
paymentId: text('payment_id'), // References the payment for purchases
|
|
54
|
-
|
|
55
|
-
sql`CURRENT_TIMESTAMP`
|
|
56
|
-
),
|
|
60
|
+
...timestampFields,
|
|
57
61
|
},
|
|
58
62
|
(t) => [index('credits_transactions_user_id_idx').on(t.userId)]
|
|
59
63
|
);
|
|
@@ -157,12 +161,7 @@ export const userConcepts = sqliteTable(
|
|
|
157
161
|
conceptCombinationId: text('concept_combination_id')
|
|
158
162
|
.notNull()
|
|
159
163
|
.references(() => conceptCombinations.id, { onDelete: 'cascade' }),
|
|
160
|
-
|
|
161
|
-
sql`CURRENT_TIMESTAMP`
|
|
162
|
-
),
|
|
163
|
-
updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
|
|
164
|
-
sql`CURRENT_TIMESTAMP`
|
|
165
|
-
),
|
|
164
|
+
...timestampFields,
|
|
166
165
|
},
|
|
167
166
|
(t) => [
|
|
168
167
|
index('user_concepts_user_id_idx').on(t.userId),
|
|
@@ -213,12 +212,7 @@ export const userArtifacts = sqliteTable(
|
|
|
213
212
|
status: text('status')
|
|
214
213
|
.default('pending') // Possible statuses: 'pending', 'post_ready', 'reel_ready', 'completed'
|
|
215
214
|
.notNull(),
|
|
216
|
-
|
|
217
|
-
sql`CURRENT_TIMESTAMP`
|
|
218
|
-
),
|
|
219
|
-
updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
|
|
220
|
-
sql`CURRENT_TIMESTAMP`
|
|
221
|
-
),
|
|
215
|
+
...timestampFields,
|
|
222
216
|
},
|
|
223
217
|
(t) => [
|
|
224
218
|
index('user_artifacts_user_id_idx').on(t.userId),
|
|
@@ -237,6 +231,7 @@ export const generations = sqliteTable(
|
|
|
237
231
|
artifactId: text('artifact_id').references(() => artifacts.id, {
|
|
238
232
|
onDelete: 'cascade',
|
|
239
233
|
}),
|
|
234
|
+
archetypeIndex: integer('archetype_index'),
|
|
240
235
|
userArtifactId: text('user_artifact_id').references(
|
|
241
236
|
() => userArtifacts.id,
|
|
242
237
|
{ onDelete: 'cascade' }
|
|
@@ -249,12 +244,7 @@ export const generations = sqliteTable(
|
|
|
249
244
|
type: text('type').notNull(), // e.g., "concept_image"
|
|
250
245
|
status: text('status').default('pending').notNull(), // "pending", "completed", "failed"
|
|
251
246
|
url: text('url'), // URL for the generated image
|
|
252
|
-
|
|
253
|
-
sql`CURRENT_TIMESTAMP`
|
|
254
|
-
),
|
|
255
|
-
updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
|
|
256
|
-
sql`CURRENT_TIMESTAMP`
|
|
257
|
-
),
|
|
247
|
+
...timestampFields,
|
|
258
248
|
},
|
|
259
249
|
(t) => [
|
|
260
250
|
index('generations_user_id_idx').on(t.userId),
|
|
@@ -270,12 +260,7 @@ export const artifactFaceswap = sqliteTable(
|
|
|
270
260
|
.notNull()
|
|
271
261
|
.references(() => userArtifacts.id, { onDelete: 'cascade' }),
|
|
272
262
|
faceSwappedImageUrl: text('face_swapped_image_url'), // Final URL of the face-swapped image
|
|
273
|
-
|
|
274
|
-
sql`CURRENT_TIMESTAMP`
|
|
275
|
-
),
|
|
276
|
-
updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
|
|
277
|
-
sql`CURRENT_TIMESTAMP`
|
|
278
|
-
),
|
|
263
|
+
...timestampFields,
|
|
279
264
|
},
|
|
280
265
|
() => []
|
|
281
266
|
);
|
|
@@ -291,6 +276,7 @@ export const artifactVideoGeneration = sqliteTable(
|
|
|
291
276
|
videoUrl: text('video_url'), // URL of the final video
|
|
292
277
|
description: text('description'), // Optional description for the video
|
|
293
278
|
duration: integer('duration'), // Duration of the video in seconds
|
|
279
|
+
...timestampFields,
|
|
294
280
|
},
|
|
295
281
|
(t) => [index('artifact_video_generation_status_idx').on(t.videoStatus)]
|
|
296
282
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zodic/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"migrate-latest-test": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1)",
|
|
11
11
|
"migrate-latest": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1) --remote",
|
|
12
12
|
"db:generate": "drizzle-kit generate",
|
|
13
|
-
"db:up": "drizzle-kit up"
|
|
13
|
+
"db:up": "drizzle-kit up",
|
|
14
|
+
"db:all": "npm run db:generate && npm run db:up && npm run migrate-latest"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
17
|
"@types/inversify": "^2.0.33",
|