This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
modules/analytics/db/migrations/20240813023547_init/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- Add timescale | ||
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; | ||
|
||
-- CreateTable | ||
CREATE TABLE "event" ( | ||
"id" UUID NOT NULL, | ||
"timestamp" TIMESTAMPTZ NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"metadata" JSONB | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "event_id_key" ON "event"("id"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "event_name_time_idx" ON "event"("name", "timestamp" DESC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model Event { | ||
id String @db.Uuid @default(uuid()) @unique | ||
timestamp DateTime @db.Timestamptz | ||
name String | ||
metadata Json? | ||
// in the init migration, we add the timescale extension and call create_hypertable(). | ||
@@index(fields: [name, timestamp(sort: Desc)], map: "event_name_time_idx") | ||
@@map("event") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"name": "Analytics", | ||
"description": "Track and visualize user behavior data. (Coming mid-2024)", | ||
"icon": "chart-line", | ||
"tags": [ | ||
"game" | ||
], | ||
"authors": [], | ||
"status": "coming_soon", | ||
"scripts": {}, | ||
"errors": {} | ||
"status": "stable", | ||
"name": "Analytics", | ||
"description": "Track and visualize user behavior data", | ||
"icon": "chart-line", | ||
"tags": [], | ||
"authors": [ | ||
"rivet-gg", | ||
"ABCxFF" | ||
], | ||
"scripts": { | ||
}, | ||
"errors": {}, | ||
"dependencies": {} | ||
} |