Database & Backend Blueprint
Next.js Drizzle ORM Schema Generator Prompt
An advanced AI prompt engineered to generate production-ready Drizzle ORM schemas and relations for Next.js applications.
Configuration Variables
Substitute these bracketed variables with your domain parameters before executing:
[YOUR_APP_IDEA][DATABASE_DIALECT]
ENGINEERED_PROMPT_PAYLOADCopy & Paste or Run in Engine
Act as a senior database architect and TypeScript engineer.
Create a production-ready Drizzle ORM schema in PostgreSQL for the following application domain:
Domain Concept: [YOUR_APP_IDEA]
Database Dialect: PostgreSQL (using drizzle-orm/pg-core)
Requirements:
1. Use pgTable with auto-generating UUID or serial primary keys.
2. Include appropriate constraints (unique indexes, foreign keys with cascade/set null, notNull).
3. Add createdAt and updatedAt timestamps with timezone.
4. Export type inferred definitions (InferSelectModel, InferInsertModel).
5. Ensure zero syntax errors and provide clean TypeScript exports.
Verified Execution Sample
import { pgTable, uuid, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
export const workspaces = pgTable("workspaces", {
id: uuid("id").primaryKey().defaultRandom(),
name: text("name").notNull(),
slug: text("slug").notNull().unique(),
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
}, (table) => ({
slugIdx: uniqueIndex("workspaces_slug_idx").on(table.slug),
}));
Tired of Manual Copy & Paste?
Execute this exact blueprint instantly in the SeaGullDT Engine using your personal API key.
