@zodic/shared 0.0.26 → 0.0.28

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 (26) hide show
  1. package/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/d379cf52b047a184ecf29a10a32b971cde5e2c256717041a7cd396844038970d.sqlite-shm +0 -0
  2. package/db/migrations/{0000_dusty_green_goblin.sql → 0000_fearless_dust.sql} +68 -19
  3. package/db/migrations/0001_known_pretty_boy.sql +20 -0
  4. package/db/migrations/0002_exotic_maria_hill.sql +2 -0
  5. package/db/migrations/meta/0000_snapshot.json +371 -22
  6. package/db/migrations/meta/0001_snapshot.json +239 -26
  7. package/db/migrations/meta/0002_snapshot.json +239 -26
  8. package/db/migrations/meta/_journal.json +6 -55
  9. package/db/schema.ts +6 -6
  10. package/package.json +4 -3
  11. package/db/migrations/0001_low_tattoo.sql +0 -20
  12. package/db/migrations/0002_condemned_turbo.sql +0 -2
  13. package/db/migrations/0003_cynical_frog_thor.sql +0 -32
  14. package/db/migrations/0004_light_masked_marvel.sql +0 -130
  15. package/db/migrations/0005_silky_dagger.sql +0 -1
  16. package/db/migrations/0006_low_silver_centurion.sql +0 -26
  17. package/db/migrations/0007_complex_tarantula.sql +0 -18
  18. package/db/migrations/0008_ancient_doomsday.sql +0 -15
  19. package/db/migrations/0009_odd_metal_master.sql +0 -33
  20. package/db/migrations/meta/0003_snapshot.json +0 -1458
  21. package/db/migrations/meta/0004_snapshot.json +0 -1480
  22. package/db/migrations/meta/0005_snapshot.json +0 -1487
  23. package/db/migrations/meta/0006_snapshot.json +0 -1487
  24. package/db/migrations/meta/0007_snapshot.json +0 -1487
  25. package/db/migrations/meta/0008_snapshot.json +0 -1590
  26. package/db/migrations/meta/0009_snapshot.json +0 -1590
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "59202e83-9c8a-494b-8dff-edd70f384e88",
5
- "prevId": "d2aec0b1-fc8e-4ef9-bcc3-a4358b1ba88a",
4
+ "id": "b03824c1-591a-44c5-beee-822a110d0daa",
5
+ "prevId": "5c06d641-2701-4f10-b160-3ee7507ef100",
6
6
  "tables": {
7
7
  "artifact_faceswap": {
8
8
  "name": "artifact_faceswap",
@@ -28,11 +28,19 @@
28
28
  "notNull": false,
29
29
  "autoincrement": false
30
30
  },
31
+ "status": {
32
+ "name": "status",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false,
37
+ "default": "'pending'"
38
+ },
31
39
  "created_at": {
32
40
  "name": "created_at",
33
41
  "type": "integer",
34
42
  "primaryKey": false,
35
- "notNull": false,
43
+ "notNull": true,
36
44
  "autoincrement": false,
37
45
  "default": "CURRENT_TIMESTAMP"
38
46
  },
@@ -40,7 +48,7 @@
40
48
  "name": "updated_at",
41
49
  "type": "integer",
42
50
  "primaryKey": false,
43
- "notNull": false,
51
+ "notNull": true,
44
52
  "autoincrement": false,
45
53
  "default": "CURRENT_TIMESTAMP"
46
54
  }
@@ -110,6 +118,22 @@
110
118
  "primaryKey": false,
111
119
  "notNull": false,
112
120
  "autoincrement": false
121
+ },
122
+ "created_at": {
123
+ "name": "created_at",
124
+ "type": "integer",
125
+ "primaryKey": false,
126
+ "notNull": true,
127
+ "autoincrement": false,
128
+ "default": "CURRENT_TIMESTAMP"
129
+ },
130
+ "updated_at": {
131
+ "name": "updated_at",
132
+ "type": "integer",
133
+ "primaryKey": false,
134
+ "notNull": true,
135
+ "autoincrement": false,
136
+ "default": "CURRENT_TIMESTAMP"
113
137
  }
114
138
  },
115
139
  "indexes": {
@@ -202,6 +226,13 @@
202
226
  }
203
227
  },
204
228
  "indexes": {
229
+ "artifacts_slug_unique": {
230
+ "name": "artifacts_slug_unique",
231
+ "columns": [
232
+ "slug"
233
+ ],
234
+ "isUnique": true
235
+ },
205
236
  "artifacts_concept_id_idx": {
206
237
  "name": "artifacts_concept_id_idx",
207
238
  "columns": [
@@ -229,6 +260,101 @@
229
260
  "uniqueConstraints": {},
230
261
  "checkConstraints": {}
231
262
  },
263
+ "astro_aspects": {
264
+ "name": "astro_aspects",
265
+ "columns": {
266
+ "id": {
267
+ "name": "id",
268
+ "type": "text",
269
+ "primaryKey": true,
270
+ "notNull": true,
271
+ "autoincrement": false
272
+ },
273
+ "user_id": {
274
+ "name": "user_id",
275
+ "type": "text",
276
+ "primaryKey": false,
277
+ "notNull": true,
278
+ "autoincrement": false
279
+ },
280
+ "aspecting_planet": {
281
+ "name": "aspecting_planet",
282
+ "type": "text",
283
+ "primaryKey": false,
284
+ "notNull": true,
285
+ "autoincrement": false
286
+ },
287
+ "aspected_planet": {
288
+ "name": "aspected_planet",
289
+ "type": "text",
290
+ "primaryKey": false,
291
+ "notNull": true,
292
+ "autoincrement": false
293
+ },
294
+ "aspecting_planet_id": {
295
+ "name": "aspecting_planet_id",
296
+ "type": "integer",
297
+ "primaryKey": false,
298
+ "notNull": true,
299
+ "autoincrement": false
300
+ },
301
+ "aspected_planet_id": {
302
+ "name": "aspected_planet_id",
303
+ "type": "integer",
304
+ "primaryKey": false,
305
+ "notNull": true,
306
+ "autoincrement": false
307
+ },
308
+ "type": {
309
+ "name": "type",
310
+ "type": "text",
311
+ "primaryKey": false,
312
+ "notNull": true,
313
+ "autoincrement": false
314
+ },
315
+ "orb": {
316
+ "name": "orb",
317
+ "type": "real",
318
+ "primaryKey": false,
319
+ "notNull": true,
320
+ "autoincrement": false
321
+ },
322
+ "diff": {
323
+ "name": "diff",
324
+ "type": "real",
325
+ "primaryKey": false,
326
+ "notNull": true,
327
+ "autoincrement": false
328
+ }
329
+ },
330
+ "indexes": {
331
+ "astro_aspects_user_id_idx": {
332
+ "name": "astro_aspects_user_id_idx",
333
+ "columns": [
334
+ "user_id"
335
+ ],
336
+ "isUnique": false
337
+ }
338
+ },
339
+ "foreignKeys": {
340
+ "astro_aspects_user_id_users_id_fk": {
341
+ "name": "astro_aspects_user_id_users_id_fk",
342
+ "tableFrom": "astro_aspects",
343
+ "tableTo": "users",
344
+ "columnsFrom": [
345
+ "user_id"
346
+ ],
347
+ "columnsTo": [
348
+ "id"
349
+ ],
350
+ "onDelete": "cascade",
351
+ "onUpdate": "no action"
352
+ }
353
+ },
354
+ "compositePrimaryKeys": {},
355
+ "uniqueConstraints": {},
356
+ "checkConstraints": {}
357
+ },
232
358
  "astro_features": {
233
359
  "name": "astro_features",
234
360
  "columns": {
@@ -278,7 +404,7 @@
278
404
  "name": "order",
279
405
  "type": "integer",
280
406
  "primaryKey": false,
281
- "notNull": true,
407
+ "notNull": false,
282
408
  "autoincrement": false
283
409
  },
284
410
  "prominent_id": {
@@ -698,14 +824,22 @@
698
824
  "name": "payment_id",
699
825
  "type": "text",
700
826
  "primaryKey": false,
701
- "notNull": false,
827
+ "notNull": true,
702
828
  "autoincrement": false
703
829
  },
704
830
  "created_at": {
705
831
  "name": "created_at",
706
832
  "type": "integer",
707
833
  "primaryKey": false,
708
- "notNull": false,
834
+ "notNull": true,
835
+ "autoincrement": false,
836
+ "default": "CURRENT_TIMESTAMP"
837
+ },
838
+ "updated_at": {
839
+ "name": "updated_at",
840
+ "type": "integer",
841
+ "primaryKey": false,
842
+ "notNull": true,
709
843
  "autoincrement": false,
710
844
  "default": "CURRENT_TIMESTAMP"
711
845
  }
@@ -752,7 +886,7 @@
752
886
  "name": "user_id",
753
887
  "type": "text",
754
888
  "primaryKey": false,
755
- "notNull": true,
889
+ "notNull": false,
756
890
  "autoincrement": false
757
891
  },
758
892
  "artifact_id": {
@@ -762,6 +896,13 @@
762
896
  "notNull": false,
763
897
  "autoincrement": false
764
898
  },
899
+ "archetype_index": {
900
+ "name": "archetype_index",
901
+ "type": "integer",
902
+ "primaryKey": false,
903
+ "notNull": false,
904
+ "autoincrement": false
905
+ },
765
906
  "user_artifact_id": {
766
907
  "name": "user_artifact_id",
767
908
  "type": "text",
@@ -769,6 +910,13 @@
769
910
  "notNull": false,
770
911
  "autoincrement": false
771
912
  },
913
+ "gender": {
914
+ "name": "gender",
915
+ "type": "text",
916
+ "primaryKey": false,
917
+ "notNull": false,
918
+ "autoincrement": false
919
+ },
772
920
  "concept_combination_id": {
773
921
  "name": "concept_combination_id",
774
922
  "type": "text",
@@ -802,7 +950,7 @@
802
950
  "name": "created_at",
803
951
  "type": "integer",
804
952
  "primaryKey": false,
805
- "notNull": false,
953
+ "notNull": true,
806
954
  "autoincrement": false,
807
955
  "default": "CURRENT_TIMESTAMP"
808
956
  },
@@ -810,7 +958,7 @@
810
958
  "name": "updated_at",
811
959
  "type": "integer",
812
960
  "primaryKey": false,
813
- "notNull": false,
961
+ "notNull": true,
814
962
  "autoincrement": false,
815
963
  "default": "CURRENT_TIMESTAMP"
816
964
  }
@@ -829,6 +977,13 @@
829
977
  "concept_combination_id"
830
978
  ],
831
979
  "isUnique": false
980
+ },
981
+ "generations_archetype_index_idx": {
982
+ "name": "generations_archetype_index_idx",
983
+ "columns": [
984
+ "archetype_index"
985
+ ],
986
+ "isUnique": false
832
987
  }
833
988
  },
834
989
  "foreignKeys": {
@@ -922,7 +1077,15 @@
922
1077
  },
923
1078
  "created_at": {
924
1079
  "name": "created_at",
925
- "type": "text",
1080
+ "type": "integer",
1081
+ "primaryKey": false,
1082
+ "notNull": true,
1083
+ "autoincrement": false,
1084
+ "default": "CURRENT_TIMESTAMP"
1085
+ },
1086
+ "updated_at": {
1087
+ "name": "updated_at",
1088
+ "type": "integer",
926
1089
  "primaryKey": false,
927
1090
  "notNull": true,
928
1091
  "autoincrement": false,
@@ -981,6 +1144,13 @@
981
1144
  "notNull": true,
982
1145
  "autoincrement": false
983
1146
  },
1147
+ "user_concept_id": {
1148
+ "name": "user_concept_id",
1149
+ "type": "text",
1150
+ "primaryKey": false,
1151
+ "notNull": true,
1152
+ "autoincrement": false
1153
+ },
984
1154
  "artifact_id": {
985
1155
  "name": "artifact_id",
986
1156
  "type": "text",
@@ -995,8 +1165,8 @@
995
1165
  "notNull": true,
996
1166
  "autoincrement": false
997
1167
  },
998
- "archetype_id": {
999
- "name": "archetype_id",
1168
+ "archetype_index": {
1169
+ "name": "archetype_index",
1000
1170
  "type": "text",
1001
1171
  "primaryKey": false,
1002
1172
  "notNull": true,
@@ -1056,7 +1226,7 @@
1056
1226
  "name": "created_at",
1057
1227
  "type": "integer",
1058
1228
  "primaryKey": false,
1059
- "notNull": false,
1229
+ "notNull": true,
1060
1230
  "autoincrement": false,
1061
1231
  "default": "CURRENT_TIMESTAMP"
1062
1232
  },
@@ -1064,7 +1234,7 @@
1064
1234
  "name": "updated_at",
1065
1235
  "type": "integer",
1066
1236
  "primaryKey": false,
1067
- "notNull": false,
1237
+ "notNull": true,
1068
1238
  "autoincrement": false,
1069
1239
  "default": "CURRENT_TIMESTAMP"
1070
1240
  }
@@ -1106,6 +1276,19 @@
1106
1276
  "onDelete": "cascade",
1107
1277
  "onUpdate": "no action"
1108
1278
  },
1279
+ "user_artifacts_user_concept_id_user_concepts_id_fk": {
1280
+ "name": "user_artifacts_user_concept_id_user_concepts_id_fk",
1281
+ "tableFrom": "user_artifacts",
1282
+ "tableTo": "user_concepts",
1283
+ "columnsFrom": [
1284
+ "user_concept_id"
1285
+ ],
1286
+ "columnsTo": [
1287
+ "id"
1288
+ ],
1289
+ "onDelete": "cascade",
1290
+ "onUpdate": "no action"
1291
+ },
1109
1292
  "user_artifacts_artifact_id_artifacts_id_fk": {
1110
1293
  "name": "user_artifacts_artifact_id_artifacts_id_fk",
1111
1294
  "tableFrom": "user_artifacts",
@@ -1159,7 +1342,7 @@
1159
1342
  "name": "created_at",
1160
1343
  "type": "integer",
1161
1344
  "primaryKey": false,
1162
- "notNull": false,
1345
+ "notNull": true,
1163
1346
  "autoincrement": false,
1164
1347
  "default": "CURRENT_TIMESTAMP"
1165
1348
  },
@@ -1167,7 +1350,7 @@
1167
1350
  "name": "updated_at",
1168
1351
  "type": "integer",
1169
1352
  "primaryKey": false,
1170
- "notNull": false,
1353
+ "notNull": true,
1171
1354
  "autoincrement": false,
1172
1355
  "default": "CURRENT_TIMESTAMP"
1173
1356
  }
@@ -1289,21 +1472,21 @@
1289
1472
  "name": "day",
1290
1473
  "type": "integer",
1291
1474
  "primaryKey": false,
1292
- "notNull": false,
1475
+ "notNull": true,
1293
1476
  "autoincrement": false
1294
1477
  },
1295
1478
  "month": {
1296
1479
  "name": "month",
1297
1480
  "type": "integer",
1298
1481
  "primaryKey": false,
1299
- "notNull": false,
1482
+ "notNull": true,
1300
1483
  "autoincrement": false
1301
1484
  },
1302
1485
  "year": {
1303
1486
  "name": "year",
1304
1487
  "type": "integer",
1305
1488
  "primaryKey": false,
1306
- "notNull": false,
1489
+ "notNull": true,
1307
1490
  "autoincrement": false
1308
1491
  },
1309
1492
  "hour": {
@@ -1324,14 +1507,14 @@
1324
1507
  "name": "latitude",
1325
1508
  "type": "real",
1326
1509
  "primaryKey": false,
1327
- "notNull": false,
1510
+ "notNull": true,
1328
1511
  "autoincrement": false
1329
1512
  },
1330
1513
  "longitude": {
1331
1514
  "name": "longitude",
1332
1515
  "type": "real",
1333
1516
  "primaryKey": false,
1334
- "notNull": false,
1517
+ "notNull": true,
1335
1518
  "autoincrement": false
1336
1519
  },
1337
1520
  "tzone": {
@@ -1348,18 +1531,26 @@
1348
1531
  "notNull": false,
1349
1532
  "autoincrement": false
1350
1533
  },
1534
+ "tiktok_username": {
1535
+ "name": "tiktok_username",
1536
+ "type": "text",
1537
+ "primaryKey": false,
1538
+ "notNull": false,
1539
+ "autoincrement": false
1540
+ },
1351
1541
  "credits_balance": {
1352
1542
  "name": "credits_balance",
1353
1543
  "type": "integer",
1354
1544
  "primaryKey": false,
1355
- "notNull": false,
1356
- "autoincrement": false
1545
+ "notNull": true,
1546
+ "autoincrement": false,
1547
+ "default": 0
1357
1548
  },
1358
1549
  "total_credits_earned": {
1359
1550
  "name": "total_credits_earned",
1360
1551
  "type": "integer",
1361
1552
  "primaryKey": false,
1362
- "notNull": false,
1553
+ "notNull": true,
1363
1554
  "autoincrement": false,
1364
1555
  "default": 0
1365
1556
  },
@@ -1372,7 +1563,15 @@
1372
1563
  },
1373
1564
  "created_at": {
1374
1565
  "name": "created_at",
1375
- "type": "text",
1566
+ "type": "integer",
1567
+ "primaryKey": false,
1568
+ "notNull": true,
1569
+ "autoincrement": false,
1570
+ "default": "CURRENT_TIMESTAMP"
1571
+ },
1572
+ "updated_at": {
1573
+ "name": "updated_at",
1574
+ "type": "integer",
1376
1575
  "primaryKey": false,
1377
1576
  "notNull": true,
1378
1577
  "autoincrement": false,
@@ -1387,6 +1586,20 @@
1387
1586
  ],
1388
1587
  "isUnique": true
1389
1588
  },
1589
+ "users_instagram_username_unique": {
1590
+ "name": "users_instagram_username_unique",
1591
+ "columns": [
1592
+ "instagram_username"
1593
+ ],
1594
+ "isUnique": true
1595
+ },
1596
+ "users_tiktok_username_unique": {
1597
+ "name": "users_tiktok_username_unique",
1598
+ "columns": [
1599
+ "tiktok_username"
1600
+ ],
1601
+ "isUnique": true
1602
+ },
1390
1603
  "users_email_idx": {
1391
1604
  "name": "users_email_idx",
1392
1605
  "columns": [
@@ -5,71 +5,22 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "6",
8
- "when": 1737425706127,
9
- "tag": "0000_dusty_green_goblin",
8
+ "when": 1737679505085,
9
+ "tag": "0000_fearless_dust",
10
10
  "breakpoints": true
11
11
  },
12
12
  {
13
13
  "idx": 1,
14
14
  "version": "6",
15
- "when": 1737478702290,
16
- "tag": "0001_low_tattoo",
15
+ "when": 1737679840599,
16
+ "tag": "0001_known_pretty_boy",
17
17
  "breakpoints": true
18
18
  },
19
19
  {
20
20
  "idx": 2,
21
21
  "version": "6",
22
- "when": 1737480263536,
23
- "tag": "0002_condemned_turbo",
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
46
- },
47
- {
48
- "idx": 6,
49
- "version": "6",
50
- "when": 1737651252070,
51
- "tag": "0006_low_silver_centurion",
52
- "breakpoints": true
53
- },
54
- {
55
- "idx": 7,
56
- "version": "6",
57
- "when": 1737664103218,
58
- "tag": "0007_complex_tarantula",
59
- "breakpoints": true
60
- },
61
- {
62
- "idx": 8,
63
- "version": "6",
64
- "when": 1737668018656,
65
- "tag": "0008_ancient_doomsday",
66
- "breakpoints": true
67
- },
68
- {
69
- "idx": 9,
70
- "version": "6",
71
- "when": 1737677651577,
72
- "tag": "0009_odd_metal_master",
22
+ "when": 1737680017244,
23
+ "tag": "0002_exotic_maria_hill",
73
24
  "breakpoints": true
74
25
  }
75
26
  ]
package/db/schema.ts CHANGED
@@ -34,8 +34,8 @@ export const users = sqliteTable(
34
34
  latitude: real('latitude').notNull(),
35
35
  longitude: real('longitude').notNull(),
36
36
  tzone: real('tzone'), // Nullable for inferred timezone
37
- instagramUsername: text('instagram_username'), // Nullable for optional social media
38
- tiktokUsername: text('tiktok_username'), // Fix typo
37
+ instagramUsername: text('instagram_username').unique(), // Nullable for optional social media
38
+ tiktokUsername: text('tiktok_username').unique(), // Fix typo
39
39
  credits_balance: integer('credits_balance').default(0).notNull(),
40
40
  totalCreditsEarned: integer('total_credits_earned').default(0).notNull(),
41
41
  lastTransactionAt: integer('last_transaction_at', { mode: 'timestamp' }), // Nullable for no transactions
@@ -56,7 +56,7 @@ export const creditsTransactions = sqliteTable(
56
56
  description: text('description'), // Optional description (e.g., "Spent on Cosmic Mirror")
57
57
  productType: text('product_type'), // e.g., "concept", "artifact", "astrology_report"
58
58
  productId: text('product_id'), // Corresponding ID for the product (concept_id, artifact_id, etc.)
59
- paymentId: text('payment_id'), // References the payment for purchases
59
+ paymentId: text('payment_id').notNull(), // References the payment for purchases
60
60
  ...timestampFields,
61
61
  },
62
62
  (t) => [index('credits_transactions_user_id_idx').on(t.userId)]
@@ -267,6 +267,7 @@ export const generations = sqliteTable(
267
267
  (t) => [
268
268
  index('generations_user_id_idx').on(t.userId),
269
269
  index('generations_concept_combination_id_idx').on(t.conceptCombinationId),
270
+ index('generations_archetype_index_idx').on(t.archetypeIndex),
270
271
  ]
271
272
  );
272
273
 
@@ -278,6 +279,7 @@ export const artifactFaceswap = sqliteTable(
278
279
  .notNull()
279
280
  .references(() => userArtifacts.id, { onDelete: 'cascade' }),
280
281
  faceSwappedImageUrl: text('face_swapped_image_url'), // Final URL of the face-swapped image
282
+ status: text('status').default('pending').notNull(), // Status of the face-swap process
281
283
  ...timestampFields,
282
284
  },
283
285
  () => []
@@ -308,9 +310,7 @@ export const tokens = sqliteTable(
308
310
  .references(() => users.id, { onDelete: 'cascade' }),
309
311
  refreshToken: text('refresh_token').unique().notNull(),
310
312
  expiresAt: text('expires_at').notNull(),
311
- createdAt: text('created_at')
312
- .default(sql`CURRENT_TIMESTAMP`)
313
- .notNull(),
313
+ ...timestampFields,
314
314
  },
315
315
  (t) => [
316
316
  index('tokens_user_id_idx').on(t.userId), // Index on user_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -8,10 +8,11 @@
8
8
  },
9
9
  "scripts": {
10
10
  "migrate-latest-test": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1)",
11
- "migrate-latest": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1) --remote",
11
+ "migrate-latest": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1) --remote --yes",
12
12
  "db:generate": "drizzle-kit generate",
13
13
  "db:up": "drizzle-kit up",
14
- "pub": "npm run db:generate && npm run db:up && npm run migrate-latest && npm publish"
14
+ "pub": "npm run db:generate && npm run db:up && npm run migrate-latest && npm publish",
15
+ "reset-db": "wrangler d1 execute DB --command \"DROP TABLE IF EXISTS migrations;\" && npm run db:up && npm run migrate-latest"
15
16
  },
16
17
  "devDependencies": {
17
18
  "@types/inversify": "^2.0.33",
@@ -1,20 +0,0 @@
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
- `created_at` integer DEFAULT CURRENT_TIMESTAMP,
6
- `updated_at` integer DEFAULT CURRENT_TIMESTAMP,
7
- FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade
8
- );
9
- --> statement-breakpoint
10
- CREATE TABLE `artifact_video_generation` (
11
- `id` text PRIMARY KEY NOT NULL,
12
- `user_artifact_id` text NOT NULL,
13
- `video_status` text DEFAULT 'pending',
14
- `video_url` text,
15
- `description` text,
16
- `duration` integer,
17
- FOREIGN KEY (`user_artifact_id`) REFERENCES `user_artifacts`(`id`) ON UPDATE no action ON DELETE cascade
18
- );
19
- --> statement-breakpoint
20
- CREATE INDEX `artifact_video_generation_status_idx` ON `artifact_video_generation` (`video_status`);
@@ -1,2 +0,0 @@
1
- ALTER TABLE `user_artifacts` ADD `post_image_id` text;--> statement-breakpoint
2
- ALTER TABLE `user_artifacts` ADD `reel_image_id` text;
@@ -1,32 +0,0 @@
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`);