-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
1 parent
bed5720
commit e234d35
Showing
41 changed files
with
2,177 additions
and
975 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -37,4 +37,4 @@ yarn-error.log* | |
next-env.d.ts | ||
|
||
# The sqlite database | ||
**/prisma/*dev.db* | ||
**/dev.db |
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
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
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
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
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
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,10 @@ | ||
import "dotenv/config"; | ||
import type { Config } from "drizzle-kit"; | ||
export default { | ||
schema: "./schema.ts", | ||
out: "./drizzle", | ||
driver: "better-sqlite", | ||
dbCredentials: { | ||
url: process.env.DATABASE_URL || "", | ||
}, | ||
} satisfies Config; |
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,7 @@ | ||
import "dotenv/config"; | ||
import { drizzle } from "drizzle-orm/better-sqlite3"; | ||
import Database from "better-sqlite3"; | ||
import * as schema from "./schema"; | ||
|
||
const sqlite = new Database(process.env.DATABASE_URL); | ||
export const db = drizzle(sqlite, { schema, logger: true }); |
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,92 @@ | ||
CREATE TABLE `account` ( | ||
`userId` text NOT NULL, | ||
`type` text NOT NULL, | ||
`provider` text NOT NULL, | ||
`providerAccountId` text NOT NULL, | ||
`refresh_token` text, | ||
`access_token` text, | ||
`expires_at` integer, | ||
`token_type` text, | ||
`scope` text, | ||
`id_token` text, | ||
`session_state` text, | ||
PRIMARY KEY(`provider`, `providerAccountId`), | ||
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `apiKey` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`name` text NOT NULL, | ||
`createdAt` integer NOT NULL, | ||
`keyId` text NOT NULL, | ||
`keyHash` text NOT NULL, | ||
`userId` text NOT NULL, | ||
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `bookmarkLinks` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`url` text NOT NULL, | ||
`title` text, | ||
`description` text, | ||
`imageUrl` text, | ||
`favicon` text, | ||
`crawledAt` integer, | ||
FOREIGN KEY (`id`) REFERENCES `bookmarks`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `bookmarkTags` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`name` text NOT NULL, | ||
`createdAt` integer NOT NULL, | ||
`userId` text NOT NULL, | ||
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `bookmarks` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`createdAt` integer NOT NULL, | ||
`archived` integer DEFAULT false NOT NULL, | ||
`favourited` integer DEFAULT false NOT NULL, | ||
`userId` text NOT NULL, | ||
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `session` ( | ||
`sessionToken` text PRIMARY KEY NOT NULL, | ||
`userId` text NOT NULL, | ||
`expires` integer NOT NULL, | ||
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `tagsOnBookmarks` ( | ||
`bookmarkId` text NOT NULL, | ||
`tagId` text NOT NULL, | ||
`attachedAt` text, | ||
`attachedBy` text, | ||
PRIMARY KEY(`bookmarkId`, `tagId`), | ||
FOREIGN KEY (`bookmarkId`) REFERENCES `bookmarks`(`id`) ON UPDATE no action ON DELETE cascade, | ||
FOREIGN KEY (`tagId`) REFERENCES `bookmarkTags`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `user` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`name` text NOT NULL, | ||
`email` text NOT NULL, | ||
`emailVerified` integer, | ||
`image` text, | ||
`password` text | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `verificationToken` ( | ||
`identifier` text NOT NULL, | ||
`token` text NOT NULL, | ||
`expires` integer NOT NULL, | ||
PRIMARY KEY(`identifier`, `token`) | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `apiKey_name_unique` ON `apiKey` (`name`);--> statement-breakpoint | ||
CREATE UNIQUE INDEX `apiKey_keyId_unique` ON `apiKey` (`keyId`);--> statement-breakpoint | ||
CREATE UNIQUE INDEX `apiKey_name_userId_unique` ON `apiKey` (`name`,`userId`);--> statement-breakpoint | ||
CREATE UNIQUE INDEX `bookmarkTags_userId_name_unique` ON `bookmarkTags` (`userId`,`name`);--> statement-breakpoint | ||
CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`); |
Oops, something went wrong.