@varaos/db 1.4.6 → 1.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varaos/db",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,23 @@
1
+ -- CreateTable
2
+ CREATE TABLE "cloudflare_metrics" (
3
+ "id" TEXT NOT NULL,
4
+ "timestamp" TIMESTAMP(3) NOT NULL,
5
+ "zoneId" TEXT NOT NULL,
6
+ "requests" BIGINT NOT NULL DEFAULT 0,
7
+ "pageViews" BIGINT NOT NULL DEFAULT 0,
8
+ "bytes" BIGINT NOT NULL DEFAULT 0,
9
+ "errors4xx" INTEGER NOT NULL DEFAULT 0,
10
+ "errors5xx" INTEGER NOT NULL DEFAULT 0,
11
+ "uniqueVisitors" INTEGER NOT NULL DEFAULT 0,
12
+ "granularity" TEXT NOT NULL DEFAULT '1h',
13
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
14
+ "updatedAt" TIMESTAMP(3) NOT NULL,
15
+
16
+ CONSTRAINT "cloudflare_metrics_pkey" PRIMARY KEY ("id")
17
+ );
18
+
19
+ -- CreateIndex
20
+ CREATE UNIQUE INDEX "cloudflare_metrics_zoneId_timestamp_granularity_key" ON "cloudflare_metrics"("zoneId", "timestamp", "granularity");
21
+
22
+ -- CreateIndex
23
+ CREATE INDEX "cloudflare_metrics_timestamp_idx" ON "cloudflare_metrics"("timestamp");
@@ -664,6 +664,26 @@ model UsageAggregate {
664
664
  @@unique([userId, workspaceId, billingPeriod, source])
665
665
  }
666
666
 
667
+ model CloudflareMetric {
668
+ id String @id @default(uuid())
669
+ timestamp DateTime
670
+ zoneId String
671
+ requests BigInt @default(0)
672
+ pageViews BigInt @default(0)
673
+ bytes BigInt @default(0)
674
+ errors4xx Int @default(0)
675
+ errors5xx Int @default(0)
676
+ uniqueVisitors Int @default(0)
677
+ granularity String @default("1h") // 1h, 1d
678
+
679
+ createdAt DateTime @default(now())
680
+ updatedAt DateTime @updatedAt
681
+
682
+ @@unique([zoneId, timestamp, granularity])
683
+ @@index([timestamp])
684
+ @@map("cloudflare_metrics")
685
+ }
686
+
667
687
  model TokenTransaction {
668
688
  id String @id @default(uuid())
669
689
  userId String