Skip to content

Commit 1e53b09

Browse files
committed
fix(db): use bigint for token counter columns in user_stats (#3755)
1 parent 2f3d524 commit 1e53b09

File tree

2 files changed

+5
-179
lines changed

2 files changed

+5
-179
lines changed

packages/db/migrations/meta/0181_snapshot.json

Lines changed: 3 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "caf7c2d3-5c1f-4689-9c0e-c3f4e9bd0a2c",
2+
"id": "1f5e66c4-0cc0-4c93-a003-577da02c23fe",
33
"prevId": "a5764b4b-e29a-4c50-a489-db8524d8101b",
44
"version": "7",
55
"dialect": "postgresql",
@@ -486,175 +486,6 @@
486486
"checkConstraints": {},
487487
"isRLSEnabled": false
488488
},
489-
"public.academy_certificate": {
490-
"name": "academy_certificate",
491-
"schema": "",
492-
"columns": {
493-
"id": {
494-
"name": "id",
495-
"type": "text",
496-
"primaryKey": true,
497-
"notNull": true
498-
},
499-
"user_id": {
500-
"name": "user_id",
501-
"type": "text",
502-
"primaryKey": false,
503-
"notNull": true
504-
},
505-
"course_id": {
506-
"name": "course_id",
507-
"type": "text",
508-
"primaryKey": false,
509-
"notNull": true
510-
},
511-
"status": {
512-
"name": "status",
513-
"type": "academy_cert_status",
514-
"typeSchema": "public",
515-
"primaryKey": false,
516-
"notNull": true,
517-
"default": "'active'"
518-
},
519-
"issued_at": {
520-
"name": "issued_at",
521-
"type": "timestamp",
522-
"primaryKey": false,
523-
"notNull": true,
524-
"default": "now()"
525-
},
526-
"expires_at": {
527-
"name": "expires_at",
528-
"type": "timestamp",
529-
"primaryKey": false,
530-
"notNull": false
531-
},
532-
"certificate_number": {
533-
"name": "certificate_number",
534-
"type": "text",
535-
"primaryKey": false,
536-
"notNull": true
537-
},
538-
"metadata": {
539-
"name": "metadata",
540-
"type": "jsonb",
541-
"primaryKey": false,
542-
"notNull": false
543-
},
544-
"created_at": {
545-
"name": "created_at",
546-
"type": "timestamp",
547-
"primaryKey": false,
548-
"notNull": true,
549-
"default": "now()"
550-
}
551-
},
552-
"indexes": {
553-
"academy_certificate_user_id_idx": {
554-
"name": "academy_certificate_user_id_idx",
555-
"columns": [
556-
{
557-
"expression": "user_id",
558-
"isExpression": false,
559-
"asc": true,
560-
"nulls": "last"
561-
}
562-
],
563-
"isUnique": false,
564-
"concurrently": false,
565-
"method": "btree",
566-
"with": {}
567-
},
568-
"academy_certificate_course_id_idx": {
569-
"name": "academy_certificate_course_id_idx",
570-
"columns": [
571-
{
572-
"expression": "course_id",
573-
"isExpression": false,
574-
"asc": true,
575-
"nulls": "last"
576-
}
577-
],
578-
"isUnique": false,
579-
"concurrently": false,
580-
"method": "btree",
581-
"with": {}
582-
},
583-
"academy_certificate_user_course_unique": {
584-
"name": "academy_certificate_user_course_unique",
585-
"columns": [
586-
{
587-
"expression": "user_id",
588-
"isExpression": false,
589-
"asc": true,
590-
"nulls": "last"
591-
},
592-
{
593-
"expression": "course_id",
594-
"isExpression": false,
595-
"asc": true,
596-
"nulls": "last"
597-
}
598-
],
599-
"isUnique": true,
600-
"concurrently": false,
601-
"method": "btree",
602-
"with": {}
603-
},
604-
"academy_certificate_number_idx": {
605-
"name": "academy_certificate_number_idx",
606-
"columns": [
607-
{
608-
"expression": "certificate_number",
609-
"isExpression": false,
610-
"asc": true,
611-
"nulls": "last"
612-
}
613-
],
614-
"isUnique": false,
615-
"concurrently": false,
616-
"method": "btree",
617-
"with": {}
618-
},
619-
"academy_certificate_status_idx": {
620-
"name": "academy_certificate_status_idx",
621-
"columns": [
622-
{
623-
"expression": "status",
624-
"isExpression": false,
625-
"asc": true,
626-
"nulls": "last"
627-
}
628-
],
629-
"isUnique": false,
630-
"concurrently": false,
631-
"method": "btree",
632-
"with": {}
633-
}
634-
},
635-
"foreignKeys": {
636-
"academy_certificate_user_id_user_id_fk": {
637-
"name": "academy_certificate_user_id_user_id_fk",
638-
"tableFrom": "academy_certificate",
639-
"tableTo": "user",
640-
"columnsFrom": ["user_id"],
641-
"columnsTo": ["id"],
642-
"onDelete": "cascade",
643-
"onUpdate": "no action"
644-
}
645-
},
646-
"compositePrimaryKeys": {},
647-
"uniqueConstraints": {
648-
"academy_certificate_certificate_number_unique": {
649-
"name": "academy_certificate_certificate_number_unique",
650-
"nullsNotDistinct": false,
651-
"columns": ["certificate_number"]
652-
}
653-
},
654-
"policies": {},
655-
"checkConstraints": {},
656-
"isRLSEnabled": false
657-
},
658489
"public.account": {
659490
"name": "account",
660491
"schema": "",
@@ -10232,7 +10063,7 @@
1023210063
},
1023310064
"total_tokens_used": {
1023410065
"name": "total_tokens_used",
10235-
"type": "integer",
10066+
"type": "bigint",
1023610067
"primaryKey": false,
1023710068
"notNull": true,
1023810069
"default": 0
@@ -10316,7 +10147,7 @@
1031610147
},
1031710148
"total_copilot_tokens": {
1031810149
"name": "total_copilot_tokens",
10319-
"type": "integer",
10150+
"type": "bigint",
1032010151
"primaryKey": false,
1032110152
"notNull": true,
1032210153
"default": 0
@@ -14500,11 +14331,6 @@
1450014331
"unknown"
1450114332
]
1450214333
},
14503-
"public.academy_cert_status": {
14504-
"name": "academy_cert_status",
14505-
"schema": "public",
14506-
"values": ["active", "revoked", "expired"]
14507-
},
1450814334
"public.billing_blocked_reason": {
1450914335
"name": "billing_blocked_reason",
1451014336
"schema": "public",

packages/db/migrations/meta/_journal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,8 +1265,8 @@
12651265
{
12661266
"idx": 181,
12671267
"version": "7",
1268-
"when": 1774404683094,
1269-
"tag": "0181_academy_certificate",
1268+
"when": 1774411211528,
1269+
"tag": "0181_dazzling_the_leader",
12701270
"breakpoints": true
12711271
}
12721272
]

0 commit comments

Comments
 (0)