-
Notifications
You must be signed in to change notification settings - Fork 307
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
Showing
7 changed files
with
155 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { env } from "@/env.js" | ||
import { type Config } from "drizzle-kit" | ||
|
||
import { databasePrefix } from "@/lib/constants" | ||
|
||
export default { | ||
schema: "./src/db/schema.ts", | ||
driver: "pg", | ||
out: "./drizzle", | ||
dbCredentials: { | ||
connectionString: env.DATABASE_URL, | ||
}, | ||
tablesFilter: ["shadcn-table_*"], | ||
tablesFilter: [`${databasePrefix}_*`], | ||
} 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,27 @@ | ||
DO $$ BEGIN | ||
CREATE TYPE "shadcn_label" AS ENUM('bug', 'feature', 'enhancement', 'documentation'); | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
CREATE TYPE "shadcn_priority" AS ENUM('low', 'medium', 'high'); | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
CREATE TYPE "shadcn_status" AS ENUM('todo', 'in-progress', 'done', 'canceled'); | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "shadcn_tasks" ( | ||
"id" varchar(128) PRIMARY KEY NOT NULL, | ||
"code" varchar(255), | ||
"title" varchar(255), | ||
"status" "shadcn_status" DEFAULT 'todo' NOT NULL, | ||
"label" "shadcn_label" DEFAULT 'bug' NOT NULL, | ||
"priority" "shadcn_priority" DEFAULT 'low' NOT NULL, | ||
CONSTRAINT "shadcn_tasks_code_unique" UNIQUE("code") | ||
); |
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,99 @@ | ||
{ | ||
"id": "604b112c-e9fc-476a-b1c3-72eb27682da3", | ||
"prevId": "00000000-0000-0000-0000-000000000000", | ||
"version": "5", | ||
"dialect": "pg", | ||
"tables": { | ||
"shadcn_tasks": { | ||
"name": "shadcn_tasks", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "varchar(128)", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"code": { | ||
"name": "code", | ||
"type": "varchar(255)", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"title": { | ||
"name": "title", | ||
"type": "varchar(255)", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"status": { | ||
"name": "status", | ||
"type": "shadcn_status", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "'todo'" | ||
}, | ||
"label": { | ||
"name": "label", | ||
"type": "shadcn_label", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "'bug'" | ||
}, | ||
"priority": { | ||
"name": "priority", | ||
"type": "shadcn_priority", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "'low'" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": { | ||
"shadcn_tasks_code_unique": { | ||
"name": "shadcn_tasks_code_unique", | ||
"nullsNotDistinct": false, | ||
"columns": [ | ||
"code" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"enums": { | ||
"shadcn_label": { | ||
"name": "shadcn_label", | ||
"values": { | ||
"bug": "bug", | ||
"feature": "feature", | ||
"enhancement": "enhancement", | ||
"documentation": "documentation" | ||
} | ||
}, | ||
"shadcn_priority": { | ||
"name": "shadcn_priority", | ||
"values": { | ||
"low": "low", | ||
"medium": "medium", | ||
"high": "high" | ||
} | ||
}, | ||
"shadcn_status": { | ||
"name": "shadcn_status", | ||
"values": { | ||
"todo": "todo", | ||
"in-progress": "in-progress", | ||
"done": "done", | ||
"canceled": "canceled" | ||
} | ||
} | ||
}, | ||
"schemas": {}, | ||
"_meta": { | ||
"columns": {}, | ||
"schemas": {}, | ||
"tables": {} | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1,13 @@ | ||
{"version":"5","dialect":"mysql","entries":[]} | ||
{ | ||
"version": "5", | ||
"dialect": "mysql", | ||
"entries": [ | ||
{ | ||
"idx": 0, | ||
"version": "5", | ||
"when": 1709909205617, | ||
"tag": "0000_married_blob", | ||
"breakpoints": 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
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,5 @@ | ||
import { pgTableCreator } from "drizzle-orm/pg-core" | ||
|
||
import { databasePrefix } from "@/lib/constants" | ||
|
||
export const pgTable = pgTableCreator((name) => `${databasePrefix}_${name}`) |
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,3 @@ | ||
export const unknownError = "An unknown error occurred. Please try again later." | ||
|
||
export const databasePrefix = "shadcn" |