一键导入
nx-database
Database management with Drizzle ORM. Use when modifying schemas, running migrations, or working with database operations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Database management with Drizzle ORM. Use when modifying schemas, running migrations, or working with database operations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Auth engine rules for QAuth. Use when working with CredentialProvider implementations, token claim generation, the provider registry, or the federation layer. Enforces the pluggable provider pattern and correct token claim behaviour.
OAuth 2.1 / OIDC rules for QAuth. Use when working with authorization endpoints, token flows, PKCE, JWKS, OIDC discovery, or spec compliance (RFC 9700, OIDC Core 1.0). Covers endpoint behaviour, email claim rules, and token security.
Database schema rules for QAuth. Use when working with the identity model, Drizzle ORM, migrations, repositories, or claim resolution. Reflects the CURRENT shipped schema — the identifier-abstraction model (ADR-002, IMPLEMENTED via Epic
Link GitHub issues in parent-child (sub-issue) relationships using GraphQL
Add a GitHub issue to a project board using gh project item-add
Create a new GitHub issue following QAuth project conventions using gh issue create
| name | nx-database |
| description | Database management with Drizzle ORM. Use when modifying schemas, running migrations, or working with database operations. |
Database infrastructure: libs/infra/db
libs/infra/db/
├── src/
│ ├── schema/ # Drizzle schemas
│ ├── migrations/ # SQL migrations
│ ├── scripts/seed.ts # Seeder
│ └── client.ts # Drizzle client
├── drizzle.config.ts
└── project.json
pnpm nx run infra-db:db:generate # Generate migration
pnpm nx run infra-db:db:migrate # Run migrations
pnpm nx run infra-db:db:studio # Drizzle Studio
pnpm nx run infra-db:db:push # Push schema (dev)
pnpm nx run infra-db:db:seed # Seed data
pnpm nx run infra-db:db:drop # Drop tables (DANGER)
# 1. Modify schema in libs/infra/db/src/schema/
# 2. Generate migration
pnpm nx run infra-db:db:generate
# 3. Review migration in libs/infra/db/src/migrations/
# 4. Apply migration
pnpm nx run infra-db:db:migrate
import { pgTable, text, bigint, uuid, jsonb } from 'drizzle-orm/pg-core';
import { uuidv7 } from 'uuidv7';
export const users = pgTable('users', {
// UUIDv7 primary key
id: uuid('id')
.primaryKey()
.$defaultFn(() => uuidv7()),
// BIGINT epoch timestamps
createdAt: bigint('created_at', { mode: 'number' })
.notNull()
.$defaultFn(() => Date.now()),
// JSONB for metadata
metadata: jsonb('metadata').$type<Record<string, unknown>>(),
// Realm for multi-tenancy
realmId: uuid('realm_id').references(() => realms.id),
});
docker compose up -d postgres
docker compose exec postgres psql -U postgres -d qauth
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/qauth