Search

PythonReactSEOPDF
GitHub Skill

database-management

Specialized skill for database operations with Drizzle ORM and Neon PostgreSQL. Use when working with schema definitions, queries, migrations, or database optimization.

artiefy☆ 2 Repository stars1 Repository forks

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

View source ↗Guides

Skill instructions

Database Management Skill

This skill provides expertise in managing the Artiefy database using Drizzle ORM with Neon PostgreSQL.

When to Use This Skill

  • Creating or modifying database schemas
  • Writing complex queries or transactions
  • Running migrations and schema changes
  • Optimizing query performance
  • Setting up new database connections

Key Technologies

  • Drizzle ORM: Type-safe SQL queries and schema definitions
  • Neon PostgreSQL: Serverless PostgreSQL database
  • Migrations: Version-controlled schema changes

Patterns and Conventions

Schema Definition
  • Schemas in drizzle/ directory
  • Use Drizzle's schema API with proper types
  • Define relations and constraints
Queries
  • Place in src/server/queries/
  • Use prepared statements for performance
  • Handle transactions for multi-step operations
Migrations
  • Run npm run db:generate to create migrations
  • Run npm run db:migrate to apply changes
  • Use npm run db:studio for visual schema management

Examples

Schema Definition
// drizzle/schema.ts
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';

export const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
  email: text('email').notNull().unique(),
  createdAt: timestamp('created_at').defaultNow(),
});
Query with Drizzle
// src/server/queries/getUsers.ts
import { db } from '@/server/db';
import { users } from '@/drizzle/schema';

export async function getUsers() {
  return await db.select().from(users);
}
Migration Script
-- migrations/001_create_users.sql
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT NOT NULL UNIQUE,
  created_at TIMESTAMP DEFAULT NOW()
);

Performance Optimization

  • Use indexes on frequently queried columns
  • Implement connection pooling with Neon
  • Monitor slow queries with EXPLAIN ANALYZE

Resources

Examples

Read the usage examples in the source repository.

View source ↗

Source history

Indexed on
2026-01-20
Index updated
2026-01-26
Branch
main

Index and sync dates describe this directory. View the source repository for code history.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!