Skip to content

Commit

Permalink
fix: save full timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
olros committed Nov 17, 2023
1 parent ff0d180 commit 595afc3
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Warnings:
- You are about to drop the `Location` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `PageViewNext` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "PageViewNext" DROP CONSTRAINT "PageViewNext_locationId_fkey";

-- DropForeignKey
ALTER TABLE "PageViewNext" DROP CONSTRAINT "PageViewNext_projectId_fkey";

-- DropTable
DROP TABLE "Location";

-- DropTable
DROP TABLE "PageViewNext";
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-- CreateTable
CREATE TABLE "PageViewNext" (
"id" UUID NOT NULL,
"date" TIMESTAMP(3) NOT NULL,
"pathname" TEXT NOT NULL,
"user_hash" TEXT NOT NULL,
"referrer" TEXT,
"browser" TEXT,
"device" TEXT,
"os" TEXT,
"locationId" INTEGER NOT NULL,
"projectId" TEXT NOT NULL,

CONSTRAINT "PageViewNext_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Location" (
"id" SERIAL NOT NULL,
"flag" TEXT NOT NULL,
"country" TEXT NOT NULL,
"city" TEXT NOT NULL,
"latitude" DOUBLE PRECISION NOT NULL,
"longitude" DOUBLE PRECISION NOT NULL,

CONSTRAINT "Location_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Location_flag_country_city_key" ON "Location"("flag", "country", "city");

-- AddForeignKey
ALTER TABLE "PageViewNext" ADD CONSTRAINT "PageViewNext_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "Location"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "PageViewNext" ADD CONSTRAINT "PageViewNext_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
2 changes: 1 addition & 1 deletion web/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ model PageVisitor {
model PageViewNext {
id String @id @default(uuid()) @db.Uuid
date DateTime @db.Date
date DateTime
pathname String
user_hash String
referrer String?
Expand Down

1 comment on commit 595afc3

@vercel
Copy link

@vercel vercel bot commented on 595afc3 Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

stats – ./

stats-nu-nine.vercel.app
stats-olros.vercel.app
stats-git-main-olros.vercel.app
stats.olafros.com

Please sign in to comment.