mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 09:17:00 +00:00
db tables update
This commit is contained in:
+4
-1
@@ -6,7 +6,10 @@
|
|||||||
"dev": "next dev --turbo",
|
"dev": "next dev --turbo",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint",
|
||||||
|
"generate": "pnpm drizzle-kit generate",
|
||||||
|
"migrate": "pnpm tsx src/db/migrate.ts",
|
||||||
|
"drop": "pnpm drizzle-kit drop"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clerk/nextjs": "^5.1.4",
|
"@clerk/nextjs": "^5.1.4",
|
||||||
|
|||||||
Generated
+3603
-2963
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
|||||||
|
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 "dates" (
|
||||||
|
"date" timestamp with time zone PRIMARY KEY NOT NULL,
|
||||||
|
CONSTRAINT "dates_date_unique" UNIQUE("date")
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE IF NOT EXISTS "events" (
|
||||||
|
"eventId" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"title" text NOT NULL,
|
||||||
|
"companyName" text NOT NULL,
|
||||||
|
"variant" "eventVariant" NOT NULL,
|
||||||
|
"time" timestamp with time zone NOT NULL,
|
||||||
|
"date" timestamp NOT NULL,
|
||||||
|
CONSTRAINT "events_companyName_unique" UNIQUE("companyName")
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE IF NOT EXISTS "symbols" (
|
||||||
|
"symbol" text PRIMARY KEY NOT NULL,
|
||||||
|
"companyName" text NOT NULL,
|
||||||
|
CONSTRAINT "symbols_symbol_unique" UNIQUE("symbol"),
|
||||||
|
CONSTRAINT "symbols_companyName_unique" UNIQUE("companyName")
|
||||||
|
);
|
||||||
|
--> 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_companyName_symbols_symbol_fk" FOREIGN KEY ("companyName") REFERENCES "public"."symbols"("symbol") ON DELETE no action ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "events" ADD CONSTRAINT "events_date_dates_date_fk" FOREIGN KEY ("date") REFERENCES "public"."dates"("date") 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 $$;
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
DO $$ BEGIN
|
|
||||||
CREATE TYPE "public"."eventVariant" AS ENUM('earnings', 'conference', 'split', 'dividend', 'econonmic', 'default');
|
|
||||||
EXCEPTION
|
|
||||||
WHEN duplicate_object THEN null;
|
|
||||||
END $$;
|
|
||||||
--> statement-breakpoint
|
|
||||||
CREATE TABLE IF NOT EXISTS "date" (
|
|
||||||
"date" timestamp with time zone PRIMARY KEY NOT NULL,
|
|
||||||
CONSTRAINT "date_date_unique" UNIQUE("date")
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
CREATE TABLE IF NOT EXISTS "event" (
|
|
||||||
"eventId" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
||||||
"title" varchar(255) NOT NULL,
|
|
||||||
"companyName" varchar(128) NOT NULL,
|
|
||||||
"variant" "eventVariant" NOT NULL,
|
|
||||||
"time" timestamp with time zone NOT NULL,
|
|
||||||
"date" timestamp NOT NULL,
|
|
||||||
CONSTRAINT "event_companyName_unique" UNIQUE("companyName")
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
CREATE TABLE IF NOT EXISTS "symbols" (
|
|
||||||
"symbol" varchar(16) PRIMARY KEY NOT NULL,
|
|
||||||
"companyName" varchar(128) NOT NULL,
|
|
||||||
CONSTRAINT "symbols_symbol_unique" UNIQUE("symbol"),
|
|
||||||
CONSTRAINT "symbols_companyName_unique" UNIQUE("companyName")
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
DO $$ BEGIN
|
|
||||||
ALTER TABLE "event" ADD CONSTRAINT "event_companyName_symbols_symbol_fk" FOREIGN KEY ("companyName") REFERENCES "public"."symbols"("symbol") ON DELETE no action ON UPDATE no action;
|
|
||||||
EXCEPTION
|
|
||||||
WHEN duplicate_object THEN null;
|
|
||||||
END $$;
|
|
||||||
--> statement-breakpoint
|
|
||||||
DO $$ BEGIN
|
|
||||||
ALTER TABLE "event" ADD CONSTRAINT "event_date_date_date_fk" FOREIGN KEY ("date") REFERENCES "public"."date"("date") ON DELETE no action ON UPDATE no action;
|
|
||||||
EXCEPTION
|
|
||||||
WHEN duplicate_object THEN null;
|
|
||||||
END $$;
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"id": "b8b76da7-bcb9-4c11-8e77-c1403d895fc7",
|
"id": "5f48754b-8b16-4f50-9273-9fa024fcbaf1",
|
||||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
"tables": {
|
"tables": {
|
||||||
"public.date": {
|
"public.dates": {
|
||||||
"name": "date",
|
"name": "dates",
|
||||||
"schema": "",
|
"schema": "",
|
||||||
"columns": {
|
"columns": {
|
||||||
"date": {
|
"date": {
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
"foreignKeys": {},
|
"foreignKeys": {},
|
||||||
"compositePrimaryKeys": {},
|
"compositePrimaryKeys": {},
|
||||||
"uniqueConstraints": {
|
"uniqueConstraints": {
|
||||||
"date_date_unique": {
|
"dates_date_unique": {
|
||||||
"name": "date_date_unique",
|
"name": "dates_date_unique",
|
||||||
"nullsNotDistinct": false,
|
"nullsNotDistinct": false,
|
||||||
"columns": [
|
"columns": [
|
||||||
"date"
|
"date"
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"public.event": {
|
"public.events": {
|
||||||
"name": "event",
|
"name": "events",
|
||||||
"schema": "",
|
"schema": "",
|
||||||
"columns": {
|
"columns": {
|
||||||
"eventId": {
|
"eventId": {
|
||||||
@@ -41,13 +41,13 @@
|
|||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"type": "varchar(255)",
|
"type": "text",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
"companyName": {
|
"companyName": {
|
||||||
"name": "companyName",
|
"name": "companyName",
|
||||||
"type": "varchar(128)",
|
"type": "text",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
@@ -73,9 +73,9 @@
|
|||||||
},
|
},
|
||||||
"indexes": {},
|
"indexes": {},
|
||||||
"foreignKeys": {
|
"foreignKeys": {
|
||||||
"event_companyName_symbols_symbol_fk": {
|
"events_companyName_symbols_symbol_fk": {
|
||||||
"name": "event_companyName_symbols_symbol_fk",
|
"name": "events_companyName_symbols_symbol_fk",
|
||||||
"tableFrom": "event",
|
"tableFrom": "events",
|
||||||
"tableTo": "symbols",
|
"tableTo": "symbols",
|
||||||
"columnsFrom": [
|
"columnsFrom": [
|
||||||
"companyName"
|
"companyName"
|
||||||
@@ -86,10 +86,10 @@
|
|||||||
"onDelete": "no action",
|
"onDelete": "no action",
|
||||||
"onUpdate": "no action"
|
"onUpdate": "no action"
|
||||||
},
|
},
|
||||||
"event_date_date_date_fk": {
|
"events_date_dates_date_fk": {
|
||||||
"name": "event_date_date_date_fk",
|
"name": "events_date_dates_date_fk",
|
||||||
"tableFrom": "event",
|
"tableFrom": "events",
|
||||||
"tableTo": "date",
|
"tableTo": "dates",
|
||||||
"columnsFrom": [
|
"columnsFrom": [
|
||||||
"date"
|
"date"
|
||||||
],
|
],
|
||||||
@@ -102,8 +102,8 @@
|
|||||||
},
|
},
|
||||||
"compositePrimaryKeys": {},
|
"compositePrimaryKeys": {},
|
||||||
"uniqueConstraints": {
|
"uniqueConstraints": {
|
||||||
"event_companyName_unique": {
|
"events_companyName_unique": {
|
||||||
"name": "event_companyName_unique",
|
"name": "events_companyName_unique",
|
||||||
"nullsNotDistinct": false,
|
"nullsNotDistinct": false,
|
||||||
"columns": [
|
"columns": [
|
||||||
"companyName"
|
"companyName"
|
||||||
@@ -117,13 +117,13 @@
|
|||||||
"columns": {
|
"columns": {
|
||||||
"symbol": {
|
"symbol": {
|
||||||
"name": "symbol",
|
"name": "symbol",
|
||||||
"type": "varchar(16)",
|
"type": "text",
|
||||||
"primaryKey": true,
|
"primaryKey": true,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
"companyName": {
|
"companyName": {
|
||||||
"name": "companyName",
|
"name": "companyName",
|
||||||
"type": "varchar(128)",
|
"type": "text",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
}
|
}
|
||||||
@@ -147,6 +147,121 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"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": {
|
"enums": {
|
||||||
@@ -161,6 +276,15 @@
|
|||||||
"econonmic",
|
"econonmic",
|
||||||
"default"
|
"default"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"public.themeMode": {
|
||||||
|
"name": "themeMode",
|
||||||
|
"schema": "public",
|
||||||
|
"values": [
|
||||||
|
"light",
|
||||||
|
"dark",
|
||||||
|
"system"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemas": {},
|
"schemas": {},
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
{
|
{
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"when": 1718582294025,
|
"when": 1718598866339,
|
||||||
"tag": "0000_lazy_maginty",
|
"tag": "0000_cute_exiles",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+18
-8
@@ -36,13 +36,23 @@ export const SymbolsTable = pgTable("symbols", {
|
|||||||
companyName: text("companyName").notNull().unique(),
|
companyName: text("companyName").notNull().unique(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// export const ThemeMode = pgEnum("themeMode", ["light", "dark", "system"]);
|
export const ThemeMode = pgEnum("themeMode", ["light", "dark", "system"]);
|
||||||
|
|
||||||
// export const UserPreferencesTable = pgTable("userPreferences", {
|
export const UserPreferencesTable = pgTable("userPreferences", {
|
||||||
// // userId: text("userId").primaryKey().notNull().unique().references(() => U),
|
userId: text("userId")
|
||||||
// theme: ThemeMode("theme").default("dark").notNull(),
|
.primaryKey()
|
||||||
// });
|
.notNull()
|
||||||
|
.unique()
|
||||||
|
.references(() => UsersTable.userId),
|
||||||
|
theme: ThemeMode("theme").default("dark").notNull(),
|
||||||
|
timezone: text("timezone").notNull().default("America/New_York"),
|
||||||
|
currencyUnits: text("currencyUnits").notNull().default("USD"),
|
||||||
|
});
|
||||||
|
|
||||||
// export const UsersTable = pgTable("users", {
|
export const UsersTable = pgTable("users", {
|
||||||
// userId: text("userId"),
|
userId: text("userId").primaryKey().notNull().unique(),
|
||||||
// });
|
firstName: text("firstName"),
|
||||||
|
lastName: text("lastName"),
|
||||||
|
emailAddress: text("emailAddress").unique().notNull(),
|
||||||
|
phoneNumber: text("phoneNumber"),
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user