Skip to content

Commit

Permalink
refactor: use drizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
TinsFox committed Nov 9, 2024
1 parent 1af7cd4 commit 6e64d86
Show file tree
Hide file tree
Showing 27 changed files with 2,377 additions and 561 deletions.
14 changes: 14 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//drizzle.config.ts
import type { Config } from "drizzle-kit"
import { config } from "dotenv"

config({ path: ".dev.vars" })

export default {
schema: "./src/db/schema.ts",
out: "./drizzle",
dialect: "postgresql",
dbCredentials: {
url: process.env.DATABASE_URL || "",
},
} satisfies Config
65 changes: 65 additions & 0 deletions drizzle/0000_luxuriant_karma.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
CREATE TABLE IF NOT EXISTS "Album" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" text NOT NULL,
"cover" text,
"url" text,
"slogan" text,
"digitalDownloads" numeric,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "Permission" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"description" text DEFAULT '' NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "Role" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"description" text DEFAULT '' NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "Task" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" text NOT NULL,
"status" text NOT NULL,
"label" text NOT NULL,
"priority" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "TeamUser" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"email" text,
"avatar" text,
"status" text NOT NULL,
"role" text NOT NULL,
"bio" text,
"amount" numeric NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "User" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"email" text NOT NULL,
"username" text,
"name" text,
"avatar" text,
"birthdate" text,
"bio" text,
"password" text NOT NULL,
"registeredAt" timestamp DEFAULT now() NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "User_email_unique" UNIQUE("email"),
CONSTRAINT "User_username_unique" UNIQUE("username")
);
Loading

0 comments on commit 6e64d86

Please sign in to comment.