mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 01:07:01 +00:00
db schema updates and mock event data
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { syncUsers } from "@/db/db";
|
import { syncUsers } from "@/db/db_calls";
|
||||||
import { SignInButton, SignedOut } from "@clerk/nextjs";
|
import { SignInButton, SignedOut } from "@clerk/nextjs";
|
||||||
import { auth, currentUser } from "@clerk/nextjs/server";
|
import { auth, currentUser } from "@clerk/nextjs/server";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"use client";
|
// "use client";
|
||||||
|
|
||||||
import { format } from "date-fns-tz";
|
import { format } from "date-fns-tz";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|||||||
@@ -14,41 +14,3 @@ const connectionString =
|
|||||||
export const client = postgres(connectionString, { prepare: false });
|
export const client = postgres(connectionString, { prepare: false });
|
||||||
|
|
||||||
export const db = drizzle(client, { schema });
|
export const db = drizzle(client, { schema });
|
||||||
|
|
||||||
// DB Calls
|
|
||||||
export const syncUsers = async ({
|
|
||||||
id,
|
|
||||||
firstName,
|
|
||||||
lastName,
|
|
||||||
primaryEmailAddress,
|
|
||||||
primaryPhoneNumber,
|
|
||||||
}: User) => {
|
|
||||||
const existingUser = await db.query.UsersTable.findFirst({
|
|
||||||
where: (UsersTable, { eq }) => eq(UsersTable.userId, id),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (primaryEmailAddress == null) {
|
|
||||||
throw new Error("No email address for user");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!existingUser) {
|
|
||||||
await db
|
|
||||||
.insert(UsersTable)
|
|
||||||
.values({
|
|
||||||
userId: id,
|
|
||||||
firstName: firstName,
|
|
||||||
lastName: lastName,
|
|
||||||
emailAddress: primaryEmailAddress.emailAddress,
|
|
||||||
phoneNumber: primaryPhoneNumber?.phoneNumber,
|
|
||||||
})
|
|
||||||
.onConflictDoUpdate({
|
|
||||||
target: UsersTable.userId,
|
|
||||||
set: {
|
|
||||||
firstName: firstName,
|
|
||||||
lastName: lastName,
|
|
||||||
emailAddress: primaryEmailAddress.emailAddress,
|
|
||||||
phoneNumber: primaryPhoneNumber?.phoneNumber,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import { User } from "@clerk/nextjs/server";
|
||||||
|
import { eq, sql, lte, gte, and, asc } from "drizzle-orm";
|
||||||
|
import { EventsTable, UsersTable } from "./schema";
|
||||||
|
import { db } from "./db";
|
||||||
|
import { format } from "date-fns";
|
||||||
|
|
||||||
|
export const syncUsers = async ({
|
||||||
|
id,
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
primaryEmailAddress,
|
||||||
|
primaryPhoneNumber,
|
||||||
|
}: User) => {
|
||||||
|
const existingUser = await db.query.UsersTable.findFirst({
|
||||||
|
where: (UsersTable, { eq }) => eq(UsersTable.userId, id),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (primaryEmailAddress == null) {
|
||||||
|
throw new Error("No email address for user");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existingUser) {
|
||||||
|
await db
|
||||||
|
.insert(UsersTable)
|
||||||
|
.values({
|
||||||
|
userId: id,
|
||||||
|
firstName: firstName,
|
||||||
|
lastName: lastName,
|
||||||
|
emailAddress: primaryEmailAddress.emailAddress,
|
||||||
|
phoneNumber: primaryPhoneNumber?.phoneNumber,
|
||||||
|
})
|
||||||
|
.onConflictDoUpdate({
|
||||||
|
target: UsersTable.userId,
|
||||||
|
set: {
|
||||||
|
firstName: firstName,
|
||||||
|
lastName: lastName,
|
||||||
|
emailAddress: primaryEmailAddress.emailAddress,
|
||||||
|
phoneNumber: primaryPhoneNumber?.phoneNumber,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface EventArray {
|
||||||
|
date: string;
|
||||||
|
events: Event[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Event {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
variant:
|
||||||
|
| "earnings"
|
||||||
|
| "conference"
|
||||||
|
| "split"
|
||||||
|
| "dividend"
|
||||||
|
| "economic"
|
||||||
|
| "default";
|
||||||
|
datetime: Date;
|
||||||
|
description?: string | null;
|
||||||
|
symbol?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getEvents = async (startDate: Date, endDate: Date) => {
|
||||||
|
const events: Event[] = await db
|
||||||
|
.select()
|
||||||
|
.from(EventsTable)
|
||||||
|
.where(and(gte(EventsTable, startDate), lte(EventsTable, endDate)))
|
||||||
|
.orderBy(asc(EventsTable.datetime));
|
||||||
|
|
||||||
|
events.forEach((e) => {
|
||||||
|
e.datetime = new Date(
|
||||||
|
e.datetime.toLocaleString("en-US", { timeZone: "America/New_York" })
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// return eventArray;
|
||||||
|
};
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."eventVariant" AS ENUM('earnings', 'conference', 'split', 'dividend', 'econonmic', 'default');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."themeMode" AS ENUM('light', 'dark', 'system');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE IF NOT EXISTS "companies" (
|
||||||
|
"symbol" text PRIMARY KEY NOT NULL,
|
||||||
|
"cik" text NOT NULL,
|
||||||
|
"companyName" text NOT NULL,
|
||||||
|
CONSTRAINT "companies_symbol_unique" UNIQUE("symbol"),
|
||||||
|
CONSTRAINT "companies_companyName_unique" UNIQUE("companyName")
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE IF NOT EXISTS "events" (
|
||||||
|
"eventId" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"title" text NOT NULL,
|
||||||
|
"symbol" text NOT NULL,
|
||||||
|
"variant" "eventVariant" NOT NULL,
|
||||||
|
"datetime" timestamp with time zone NOT NULL
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE IF NOT EXISTS "userPreferences" (
|
||||||
|
"userId" text PRIMARY KEY NOT NULL,
|
||||||
|
"theme" "themeMode" DEFAULT 'dark' NOT NULL,
|
||||||
|
"timezone" text DEFAULT 'America/New_York' NOT NULL,
|
||||||
|
"currencyUnits" text DEFAULT 'USD' NOT NULL,
|
||||||
|
CONSTRAINT "userPreferences_userId_unique" UNIQUE("userId")
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE IF NOT EXISTS "users" (
|
||||||
|
"userId" text PRIMARY KEY NOT NULL,
|
||||||
|
"firstName" text,
|
||||||
|
"lastName" text,
|
||||||
|
"emailAddress" text NOT NULL,
|
||||||
|
"phoneNumber" text,
|
||||||
|
CONSTRAINT "users_userId_unique" UNIQUE("userId"),
|
||||||
|
CONSTRAINT "users_emailAddress_unique" UNIQUE("emailAddress")
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "events" ADD CONSTRAINT "events_symbol_companies_symbol_fk" FOREIGN KEY ("symbol") REFERENCES "public"."companies"("symbol") ON DELETE no action ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "userPreferences" ADD CONSTRAINT "userPreferences_userId_users_userId_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("userId") ON DELETE no action ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "events" ADD COLUMN "description" text;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "events" ALTER COLUMN "symbol" DROP NOT NULL;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TYPE "eventVariant" ADD VALUE 'economic';
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
{
|
||||||
|
"id": "c02a41be-90a6-486e-9324-d6b9b276b1f0",
|
||||||
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.companies": {
|
||||||
|
"name": "companies",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"cik": {
|
||||||
|
"name": "cik",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"companyName": {
|
||||||
|
"name": "companyName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"companies_symbol_unique": {
|
||||||
|
"name": "companies_symbol_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"symbol"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"companies_companyName_unique": {
|
||||||
|
"name": "companies_companyName_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"companyName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.events": {
|
||||||
|
"name": "events",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"eventId": {
|
||||||
|
"name": "eventId",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"variant": {
|
||||||
|
"name": "variant",
|
||||||
|
"type": "eventVariant",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"datetime": {
|
||||||
|
"name": "datetime",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"events_symbol_companies_symbol_fk": {
|
||||||
|
"name": "events_symbol_companies_symbol_fk",
|
||||||
|
"tableFrom": "events",
|
||||||
|
"tableTo": "companies",
|
||||||
|
"columnsFrom": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {}
|
||||||
|
},
|
||||||
|
"public.userPreferences": {
|
||||||
|
"name": "userPreferences",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"theme": {
|
||||||
|
"name": "theme",
|
||||||
|
"type": "themeMode",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'dark'"
|
||||||
|
},
|
||||||
|
"timezone": {
|
||||||
|
"name": "timezone",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'America/New_York'"
|
||||||
|
},
|
||||||
|
"currencyUnits": {
|
||||||
|
"name": "currencyUnits",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'USD'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"userPreferences_userId_users_userId_fk": {
|
||||||
|
"name": "userPreferences_userId_users_userId_fk",
|
||||||
|
"tableFrom": "userPreferences",
|
||||||
|
"tableTo": "users",
|
||||||
|
"columnsFrom": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"userPreferences_userId_unique": {
|
||||||
|
"name": "userPreferences_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.users": {
|
||||||
|
"name": "users",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"firstName": {
|
||||||
|
"name": "firstName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"lastName": {
|
||||||
|
"name": "lastName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"emailAddress": {
|
||||||
|
"name": "emailAddress",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"phoneNumber": {
|
||||||
|
"name": "phoneNumber",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"users_userId_unique": {
|
||||||
|
"name": "users_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"users_emailAddress_unique": {
|
||||||
|
"name": "users_emailAddress_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"emailAddress"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {
|
||||||
|
"public.eventVariant": {
|
||||||
|
"name": "eventVariant",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"earnings",
|
||||||
|
"conference",
|
||||||
|
"split",
|
||||||
|
"dividend",
|
||||||
|
"econonmic",
|
||||||
|
"default"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"public.themeMode": {
|
||||||
|
"name": "themeMode",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"light",
|
||||||
|
"dark",
|
||||||
|
"system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schemas": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
{
|
||||||
|
"id": "0f787722-b7c9-4a90-9fb0-ffbbadd33c8e",
|
||||||
|
"prevId": "c02a41be-90a6-486e-9324-d6b9b276b1f0",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.companies": {
|
||||||
|
"name": "companies",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"cik": {
|
||||||
|
"name": "cik",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"companyName": {
|
||||||
|
"name": "companyName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"companies_symbol_unique": {
|
||||||
|
"name": "companies_symbol_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"symbol"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"companies_companyName_unique": {
|
||||||
|
"name": "companies_companyName_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"companyName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.events": {
|
||||||
|
"name": "events",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"eventId": {
|
||||||
|
"name": "eventId",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"variant": {
|
||||||
|
"name": "variant",
|
||||||
|
"type": "eventVariant",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"datetime": {
|
||||||
|
"name": "datetime",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"name": "description",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"events_symbol_companies_symbol_fk": {
|
||||||
|
"name": "events_symbol_companies_symbol_fk",
|
||||||
|
"tableFrom": "events",
|
||||||
|
"tableTo": "companies",
|
||||||
|
"columnsFrom": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {}
|
||||||
|
},
|
||||||
|
"public.userPreferences": {
|
||||||
|
"name": "userPreferences",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"theme": {
|
||||||
|
"name": "theme",
|
||||||
|
"type": "themeMode",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'dark'"
|
||||||
|
},
|
||||||
|
"timezone": {
|
||||||
|
"name": "timezone",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'America/New_York'"
|
||||||
|
},
|
||||||
|
"currencyUnits": {
|
||||||
|
"name": "currencyUnits",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'USD'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"userPreferences_userId_users_userId_fk": {
|
||||||
|
"name": "userPreferences_userId_users_userId_fk",
|
||||||
|
"tableFrom": "userPreferences",
|
||||||
|
"tableTo": "users",
|
||||||
|
"columnsFrom": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"userPreferences_userId_unique": {
|
||||||
|
"name": "userPreferences_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.users": {
|
||||||
|
"name": "users",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"firstName": {
|
||||||
|
"name": "firstName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"lastName": {
|
||||||
|
"name": "lastName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"emailAddress": {
|
||||||
|
"name": "emailAddress",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"phoneNumber": {
|
||||||
|
"name": "phoneNumber",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"users_userId_unique": {
|
||||||
|
"name": "users_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"users_emailAddress_unique": {
|
||||||
|
"name": "users_emailAddress_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"emailAddress"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {
|
||||||
|
"public.eventVariant": {
|
||||||
|
"name": "eventVariant",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"earnings",
|
||||||
|
"conference",
|
||||||
|
"split",
|
||||||
|
"dividend",
|
||||||
|
"econonmic",
|
||||||
|
"default"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"public.themeMode": {
|
||||||
|
"name": "themeMode",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"light",
|
||||||
|
"dark",
|
||||||
|
"system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schemas": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
{
|
||||||
|
"id": "afc01ef3-4513-45a7-8a87-88c54d7d1ad1",
|
||||||
|
"prevId": "0f787722-b7c9-4a90-9fb0-ffbbadd33c8e",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.companies": {
|
||||||
|
"name": "companies",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"cik": {
|
||||||
|
"name": "cik",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"companyName": {
|
||||||
|
"name": "companyName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"companies_symbol_unique": {
|
||||||
|
"name": "companies_symbol_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"symbol"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"companies_companyName_unique": {
|
||||||
|
"name": "companies_companyName_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"companyName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.events": {
|
||||||
|
"name": "events",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"eventId": {
|
||||||
|
"name": "eventId",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"variant": {
|
||||||
|
"name": "variant",
|
||||||
|
"type": "eventVariant",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"datetime": {
|
||||||
|
"name": "datetime",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"name": "description",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"events_symbol_companies_symbol_fk": {
|
||||||
|
"name": "events_symbol_companies_symbol_fk",
|
||||||
|
"tableFrom": "events",
|
||||||
|
"tableTo": "companies",
|
||||||
|
"columnsFrom": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {}
|
||||||
|
},
|
||||||
|
"public.userPreferences": {
|
||||||
|
"name": "userPreferences",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"theme": {
|
||||||
|
"name": "theme",
|
||||||
|
"type": "themeMode",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'dark'"
|
||||||
|
},
|
||||||
|
"timezone": {
|
||||||
|
"name": "timezone",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'America/New_York'"
|
||||||
|
},
|
||||||
|
"currencyUnits": {
|
||||||
|
"name": "currencyUnits",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'USD'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"userPreferences_userId_users_userId_fk": {
|
||||||
|
"name": "userPreferences_userId_users_userId_fk",
|
||||||
|
"tableFrom": "userPreferences",
|
||||||
|
"tableTo": "users",
|
||||||
|
"columnsFrom": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"userPreferences_userId_unique": {
|
||||||
|
"name": "userPreferences_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.users": {
|
||||||
|
"name": "users",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"firstName": {
|
||||||
|
"name": "firstName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"lastName": {
|
||||||
|
"name": "lastName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"emailAddress": {
|
||||||
|
"name": "emailAddress",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"phoneNumber": {
|
||||||
|
"name": "phoneNumber",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"users_userId_unique": {
|
||||||
|
"name": "users_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"users_emailAddress_unique": {
|
||||||
|
"name": "users_emailAddress_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"emailAddress"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {
|
||||||
|
"public.eventVariant": {
|
||||||
|
"name": "eventVariant",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"earnings",
|
||||||
|
"conference",
|
||||||
|
"split",
|
||||||
|
"dividend",
|
||||||
|
"econonmic",
|
||||||
|
"default"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"public.themeMode": {
|
||||||
|
"name": "themeMode",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"light",
|
||||||
|
"dark",
|
||||||
|
"system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schemas": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
{
|
||||||
|
"id": "878a3666-4f47-4528-aca9-5a7750887307",
|
||||||
|
"prevId": "afc01ef3-4513-45a7-8a87-88c54d7d1ad1",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.companies": {
|
||||||
|
"name": "companies",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"cik": {
|
||||||
|
"name": "cik",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"companyName": {
|
||||||
|
"name": "companyName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"companies_symbol_unique": {
|
||||||
|
"name": "companies_symbol_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"symbol"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"companies_companyName_unique": {
|
||||||
|
"name": "companies_companyName_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"companyName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.events": {
|
||||||
|
"name": "events",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"eventId": {
|
||||||
|
"name": "eventId",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"symbol": {
|
||||||
|
"name": "symbol",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"variant": {
|
||||||
|
"name": "variant",
|
||||||
|
"type": "eventVariant",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"datetime": {
|
||||||
|
"name": "datetime",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"name": "description",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"events_symbol_companies_symbol_fk": {
|
||||||
|
"name": "events_symbol_companies_symbol_fk",
|
||||||
|
"tableFrom": "events",
|
||||||
|
"tableTo": "companies",
|
||||||
|
"columnsFrom": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"symbol"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {}
|
||||||
|
},
|
||||||
|
"public.userPreferences": {
|
||||||
|
"name": "userPreferences",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"theme": {
|
||||||
|
"name": "theme",
|
||||||
|
"type": "themeMode",
|
||||||
|
"typeSchema": "public",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'dark'"
|
||||||
|
},
|
||||||
|
"timezone": {
|
||||||
|
"name": "timezone",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'America/New_York'"
|
||||||
|
},
|
||||||
|
"currencyUnits": {
|
||||||
|
"name": "currencyUnits",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'USD'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"userPreferences_userId_users_userId_fk": {
|
||||||
|
"name": "userPreferences_userId_users_userId_fk",
|
||||||
|
"tableFrom": "userPreferences",
|
||||||
|
"tableTo": "users",
|
||||||
|
"columnsFrom": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"userPreferences_userId_unique": {
|
||||||
|
"name": "userPreferences_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"public.users": {
|
||||||
|
"name": "users",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"userId": {
|
||||||
|
"name": "userId",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"firstName": {
|
||||||
|
"name": "firstName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"lastName": {
|
||||||
|
"name": "lastName",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"emailAddress": {
|
||||||
|
"name": "emailAddress",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"phoneNumber": {
|
||||||
|
"name": "phoneNumber",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"users_userId_unique": {
|
||||||
|
"name": "users_userId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"users_emailAddress_unique": {
|
||||||
|
"name": "users_emailAddress_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"emailAddress"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {
|
||||||
|
"public.eventVariant": {
|
||||||
|
"name": "eventVariant",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"earnings",
|
||||||
|
"conference",
|
||||||
|
"split",
|
||||||
|
"dividend",
|
||||||
|
"economic",
|
||||||
|
"default"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"public.themeMode": {
|
||||||
|
"name": "themeMode",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"light",
|
||||||
|
"dark",
|
||||||
|
"system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schemas": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,34 @@
|
|||||||
{"version":"7","dialect":"postgresql","entries":[]}
|
{
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"idx": 0,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1718764999793,
|
||||||
|
"tag": "0000_dear_dagger",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 1,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1718765213486,
|
||||||
|
"tag": "0001_flowery_harpoon",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 2,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1718765530419,
|
||||||
|
"tag": "0002_grey_white_tiger",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 3,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1718765763155,
|
||||||
|
"tag": "0003_flat_wind_dancer",
|
||||||
|
"breakpoints": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+21
-17
@@ -1,38 +1,42 @@
|
|||||||
import { pgEnum, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
import { pgEnum, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
||||||
import { sql } from "drizzle-orm";
|
import { sql } from "drizzle-orm";
|
||||||
|
|
||||||
export const DateTable = pgTable("dates", {
|
// export const DateTable = pgTable("dates", {
|
||||||
date: timestamp("date", { withTimezone: true })
|
// date: timestamp("date", { withTimezone: true })
|
||||||
.unique()
|
// .unique()
|
||||||
.notNull()
|
// .notNull()
|
||||||
.primaryKey(),
|
// .primaryKey(),
|
||||||
});
|
// });
|
||||||
|
|
||||||
export const EventVariant = pgEnum("eventVariant", [
|
export const EventVariant = pgEnum("eventVariant", [
|
||||||
"earnings",
|
"earnings",
|
||||||
"conference",
|
"conference",
|
||||||
"split",
|
"split",
|
||||||
"dividend",
|
"dividend",
|
||||||
"econonmic",
|
"economic",
|
||||||
"default",
|
"default",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const EventsTable = pgTable("events", {
|
export const EventsTable = pgTable("events", {
|
||||||
id: uuid("eventId").primaryKey().defaultRandom(),
|
id: uuid("eventId").primaryKey().defaultRandom(),
|
||||||
title: text("title").notNull(),
|
title: text("title").notNull(),
|
||||||
companyName: text("companyName")
|
// companyName: text("companyName")
|
||||||
.notNull()
|
// .notNull()
|
||||||
.unique()
|
// .unique()
|
||||||
.references(() => SymbolsTable.symbol),
|
// .references(() => SymbolsTable.symbol),
|
||||||
|
symbol: text("symbol").references(() => CompanyTable.symbol),
|
||||||
variant: EventVariant("variant").notNull(),
|
variant: EventVariant("variant").notNull(),
|
||||||
time: timestamp("time", { withTimezone: true }).notNull(),
|
datetime: timestamp("datetime", { withTimezone: true }).notNull(),
|
||||||
date: timestamp("date")
|
description: text("description"),
|
||||||
.references(() => DateTable.date)
|
// time: timestamp("time", { withTimezone: true }).notNull(),
|
||||||
.notNull(),
|
// date: timestamp("date")
|
||||||
|
// .references(() => DateTable.date)
|
||||||
|
// .notNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SymbolsTable = pgTable("symbols", {
|
export const CompanyTable = pgTable("companies", {
|
||||||
symbol: text("symbol").notNull().primaryKey().unique(),
|
symbol: text("symbol").notNull().unique().primaryKey(),
|
||||||
|
cik: text("cik").notNull(),
|
||||||
companyName: text("companyName").notNull().unique(),
|
companyName: text("companyName").notNull().unique(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user