forge-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/worktree-create.sh +64 -0
- package/.claude/hooks/worktree-remove.sh +57 -0
- package/.claude/settings.local.json +29 -0
- package/.forge/knowledge/conventions.yaml +1 -0
- package/.forge/knowledge/decisions.yaml +1 -0
- package/.forge/knowledge/gotchas.yaml +1 -0
- package/.forge/knowledge/patterns.yaml +1 -0
- package/.forge/manifest.yaml +6 -0
- package/CLAUDE.md +144 -0
- package/bin/setup-forge.sh +132 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +553 -0
- package/dist/cli.js.map +1 -0
- package/dist/context/codebase.d.ts +57 -0
- package/dist/context/codebase.d.ts.map +1 -0
- package/dist/context/codebase.js +301 -0
- package/dist/context/codebase.js.map +1 -0
- package/dist/context/injector.d.ts +147 -0
- package/dist/context/injector.d.ts.map +1 -0
- package/dist/context/injector.js +533 -0
- package/dist/context/injector.js.map +1 -0
- package/dist/context/memory.d.ts +32 -0
- package/dist/context/memory.d.ts.map +1 -0
- package/dist/context/memory.js +140 -0
- package/dist/context/memory.js.map +1 -0
- package/dist/context/session-index.d.ts +54 -0
- package/dist/context/session-index.d.ts.map +1 -0
- package/dist/context/session-index.js +265 -0
- package/dist/context/session-index.js.map +1 -0
- package/dist/context/session.d.ts +42 -0
- package/dist/context/session.d.ts.map +1 -0
- package/dist/context/session.js +121 -0
- package/dist/context/session.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/ingestion/chunker.d.ts +19 -0
- package/dist/ingestion/chunker.d.ts.map +1 -0
- package/dist/ingestion/chunker.js +189 -0
- package/dist/ingestion/chunker.js.map +1 -0
- package/dist/ingestion/embedder.d.ts +45 -0
- package/dist/ingestion/embedder.d.ts.map +1 -0
- package/dist/ingestion/embedder.js +152 -0
- package/dist/ingestion/embedder.js.map +1 -0
- package/dist/ingestion/git-analyzer.d.ts +77 -0
- package/dist/ingestion/git-analyzer.d.ts.map +1 -0
- package/dist/ingestion/git-analyzer.js +437 -0
- package/dist/ingestion/git-analyzer.js.map +1 -0
- package/dist/ingestion/indexer.d.ts +79 -0
- package/dist/ingestion/indexer.d.ts.map +1 -0
- package/dist/ingestion/indexer.js +766 -0
- package/dist/ingestion/indexer.js.map +1 -0
- package/dist/ingestion/markdown-chunker.d.ts +19 -0
- package/dist/ingestion/markdown-chunker.d.ts.map +1 -0
- package/dist/ingestion/markdown-chunker.js +243 -0
- package/dist/ingestion/markdown-chunker.js.map +1 -0
- package/dist/ingestion/markdown-knowledge.d.ts +21 -0
- package/dist/ingestion/markdown-knowledge.d.ts.map +1 -0
- package/dist/ingestion/markdown-knowledge.js +129 -0
- package/dist/ingestion/markdown-knowledge.js.map +1 -0
- package/dist/ingestion/parser.d.ts +20 -0
- package/dist/ingestion/parser.d.ts.map +1 -0
- package/dist/ingestion/parser.js +429 -0
- package/dist/ingestion/parser.js.map +1 -0
- package/dist/ingestion/watcher.d.ts +28 -0
- package/dist/ingestion/watcher.d.ts.map +1 -0
- package/dist/ingestion/watcher.js +147 -0
- package/dist/ingestion/watcher.js.map +1 -0
- package/dist/knowledge/hydrator.d.ts +37 -0
- package/dist/knowledge/hydrator.d.ts.map +1 -0
- package/dist/knowledge/hydrator.js +220 -0
- package/dist/knowledge/hydrator.js.map +1 -0
- package/dist/knowledge/registry.d.ts +129 -0
- package/dist/knowledge/registry.d.ts.map +1 -0
- package/dist/knowledge/registry.js +361 -0
- package/dist/knowledge/registry.js.map +1 -0
- package/dist/knowledge/search.d.ts +114 -0
- package/dist/knowledge/search.d.ts.map +1 -0
- package/dist/knowledge/search.js +428 -0
- package/dist/knowledge/search.js.map +1 -0
- package/dist/knowledge/store.d.ts +76 -0
- package/dist/knowledge/store.d.ts.map +1 -0
- package/dist/knowledge/store.js +230 -0
- package/dist/knowledge/store.js.map +1 -0
- package/dist/learning/confidence.d.ts +30 -0
- package/dist/learning/confidence.d.ts.map +1 -0
- package/dist/learning/confidence.js +165 -0
- package/dist/learning/confidence.js.map +1 -0
- package/dist/learning/patterns.d.ts +52 -0
- package/dist/learning/patterns.d.ts.map +1 -0
- package/dist/learning/patterns.js +290 -0
- package/dist/learning/patterns.js.map +1 -0
- package/dist/learning/trajectory.d.ts +55 -0
- package/dist/learning/trajectory.d.ts.map +1 -0
- package/dist/learning/trajectory.js +200 -0
- package/dist/learning/trajectory.js.map +1 -0
- package/dist/memory/memory-compat.d.ts +100 -0
- package/dist/memory/memory-compat.d.ts.map +1 -0
- package/dist/memory/memory-compat.js +146 -0
- package/dist/memory/memory-compat.js.map +1 -0
- package/dist/memory/observation-store.d.ts +57 -0
- package/dist/memory/observation-store.d.ts.map +1 -0
- package/dist/memory/observation-store.js +154 -0
- package/dist/memory/observation-store.js.map +1 -0
- package/dist/memory/session-tracker.d.ts +81 -0
- package/dist/memory/session-tracker.d.ts.map +1 -0
- package/dist/memory/session-tracker.js +262 -0
- package/dist/memory/session-tracker.js.map +1 -0
- package/dist/pipeline/engine.d.ts +179 -0
- package/dist/pipeline/engine.d.ts.map +1 -0
- package/dist/pipeline/engine.js +691 -0
- package/dist/pipeline/engine.js.map +1 -0
- package/dist/pipeline/events.d.ts +54 -0
- package/dist/pipeline/events.d.ts.map +1 -0
- package/dist/pipeline/events.js +157 -0
- package/dist/pipeline/events.js.map +1 -0
- package/dist/pipeline/parallel.d.ts +83 -0
- package/dist/pipeline/parallel.d.ts.map +1 -0
- package/dist/pipeline/parallel.js +277 -0
- package/dist/pipeline/parallel.js.map +1 -0
- package/dist/pipeline/state-machine.d.ts +65 -0
- package/dist/pipeline/state-machine.d.ts.map +1 -0
- package/dist/pipeline/state-machine.js +176 -0
- package/dist/pipeline/state-machine.js.map +1 -0
- package/dist/query/graph-queries.d.ts +84 -0
- package/dist/query/graph-queries.d.ts.map +1 -0
- package/dist/query/graph-queries.js +216 -0
- package/dist/query/graph-queries.js.map +1 -0
- package/dist/query/hybrid-search.d.ts +34 -0
- package/dist/query/hybrid-search.d.ts.map +1 -0
- package/dist/query/hybrid-search.js +263 -0
- package/dist/query/hybrid-search.js.map +1 -0
- package/dist/query/intent-detector.d.ts +35 -0
- package/dist/query/intent-detector.d.ts.map +1 -0
- package/dist/query/intent-detector.js +115 -0
- package/dist/query/intent-detector.js.map +1 -0
- package/dist/query/ranking.d.ts +57 -0
- package/dist/query/ranking.d.ts.map +1 -0
- package/dist/query/ranking.js +109 -0
- package/dist/query/ranking.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +291 -0
- package/dist/server.js.map +1 -0
- package/dist/storage/falkordb-store.d.ts +73 -0
- package/dist/storage/falkordb-store.d.ts.map +1 -0
- package/dist/storage/falkordb-store.js +346 -0
- package/dist/storage/falkordb-store.js.map +1 -0
- package/dist/storage/file-cache.d.ts +32 -0
- package/dist/storage/file-cache.d.ts.map +1 -0
- package/dist/storage/file-cache.js +115 -0
- package/dist/storage/file-cache.js.map +1 -0
- package/dist/storage/interfaces.d.ts +151 -0
- package/dist/storage/interfaces.d.ts.map +1 -0
- package/dist/storage/interfaces.js +7 -0
- package/dist/storage/interfaces.js.map +1 -0
- package/dist/storage/qdrant-store.d.ts +110 -0
- package/dist/storage/qdrant-store.d.ts.map +1 -0
- package/dist/storage/qdrant-store.js +467 -0
- package/dist/storage/qdrant-store.js.map +1 -0
- package/dist/storage/schema.d.ts +4 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +136 -0
- package/dist/storage/schema.js.map +1 -0
- package/dist/storage/sqlite.d.ts +35 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +132 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/tools/collaboration-tools.d.ts +111 -0
- package/dist/tools/collaboration-tools.d.ts.map +1 -0
- package/dist/tools/collaboration-tools.js +174 -0
- package/dist/tools/collaboration-tools.js.map +1 -0
- package/dist/tools/context-tools.d.ts +293 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +437 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +129 -0
- package/dist/tools/graph-tools.d.ts.map +1 -0
- package/dist/tools/graph-tools.js +237 -0
- package/dist/tools/graph-tools.js.map +1 -0
- package/dist/tools/ingestion-tools.d.ts +96 -0
- package/dist/tools/ingestion-tools.d.ts.map +1 -0
- package/dist/tools/ingestion-tools.js +90 -0
- package/dist/tools/ingestion-tools.js.map +1 -0
- package/dist/tools/learning-tools.d.ts +168 -0
- package/dist/tools/learning-tools.d.ts.map +1 -0
- package/dist/tools/learning-tools.js +158 -0
- package/dist/tools/learning-tools.js.map +1 -0
- package/dist/tools/memory-tools.d.ts +183 -0
- package/dist/tools/memory-tools.d.ts.map +1 -0
- package/dist/tools/memory-tools.js +197 -0
- package/dist/tools/memory-tools.js.map +1 -0
- package/dist/tools/phase-tools.d.ts +954 -0
- package/dist/tools/phase-tools.d.ts.map +1 -0
- package/dist/tools/phase-tools.js +1215 -0
- package/dist/tools/phase-tools.js.map +1 -0
- package/dist/tools/pipeline-tools.d.ts +140 -0
- package/dist/tools/pipeline-tools.d.ts.map +1 -0
- package/dist/tools/pipeline-tools.js +162 -0
- package/dist/tools/pipeline-tools.js.map +1 -0
- package/dist/tools/registration-tools.d.ts +220 -0
- package/dist/tools/registration-tools.d.ts.map +1 -0
- package/dist/tools/registration-tools.js +391 -0
- package/dist/tools/registration-tools.js.map +1 -0
- package/dist/util/circuit-breaker.d.ts +75 -0
- package/dist/util/circuit-breaker.d.ts.map +1 -0
- package/dist/util/circuit-breaker.js +159 -0
- package/dist/util/circuit-breaker.js.map +1 -0
- package/dist/util/config.d.ts +23 -0
- package/dist/util/config.d.ts.map +1 -0
- package/dist/util/config.js +164 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/logger.d.ts +13 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +45 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/token-counter.d.ts +24 -0
- package/dist/util/token-counter.d.ts.map +1 -0
- package/dist/util/token-counter.js +48 -0
- package/dist/util/token-counter.js.map +1 -0
- package/dist/util/types.d.ts +525 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +5 -0
- package/dist/util/types.js.map +1 -0
- package/docker-compose.yml +20 -0
- package/docs/plans/2026-02-27-swarm-coordination/architecture.md +203 -0
- package/docs/plans/2026-02-27-swarm-coordination/vision.md +57 -0
- package/docs/plans/completed/2026-02-26-forge-plugin-bundling/architecture.md +1 -0
- package/docs/plans/completed/2026-02-26-forge-plugin-bundling/vision.md +300 -0
- package/docs/plans/completed/2026-02-27-forge-swarm-learning/architecture.md +480 -0
- package/docs/plans/completed/2026-02-27-forge-swarm-learning/verification-checklist.md +462 -0
- package/docs/plans/completed/2026-02-27-git-history-atlassian/git-jira-plan.md +181 -0
- package/package.json +39 -0
- package/plugin/.claude-plugin/plugin.json +8 -0
- package/plugin/.mcp.json +15 -0
- package/plugin/README.md +134 -0
- package/plugin/agents/architect.md +367 -0
- package/plugin/agents/backend-specialist.md +263 -0
- package/plugin/agents/brainstormer.md +122 -0
- package/plugin/agents/data-specialist.md +266 -0
- package/plugin/agents/designer.md +408 -0
- package/plugin/agents/frontend-specialist.md +241 -0
- package/plugin/agents/inspector.md +406 -0
- package/plugin/agents/knowledge-keeper.md +443 -0
- package/plugin/agents/platform-engineer.md +326 -0
- package/plugin/agents/product-manager.md +268 -0
- package/plugin/agents/product-owner.md +438 -0
- package/plugin/agents/pulse-checker.md +73 -0
- package/plugin/agents/qa-strategist.md +500 -0
- package/plugin/agents/self-improver.md +310 -0
- package/plugin/agents/strategist.md +360 -0
- package/plugin/agents/supervisor.md +380 -0
- package/plugin/commands/brainstorm.md +25 -0
- package/plugin/commands/forge.md +88 -0
- package/plugin/docs/atlassian-integration.md +110 -0
- package/plugin/docs/workflow.md +126 -0
- package/plugin/skills/agent-development/.skillfish.json +10 -0
- package/plugin/skills/agent-development/SKILL.md +415 -0
- package/plugin/skills/agent-development/examples/agent-creation-prompt.md +238 -0
- package/plugin/skills/agent-development/examples/complete-agent-examples.md +427 -0
- package/plugin/skills/agent-development/references/agent-creation-system-prompt.md +207 -0
- package/plugin/skills/agent-development/references/system-prompt-design.md +411 -0
- package/plugin/skills/agent-development/references/triggering-examples.md +491 -0
- package/plugin/skills/agent-development/scripts/validate-agent.sh +217 -0
- package/plugin/skills/agent-handoff/SKILL.md +335 -0
- package/plugin/skills/anti-stub/SKILL.md +317 -0
- package/plugin/skills/brainstorm/SKILL.md +31 -0
- package/plugin/skills/debugging/SKILL.md +276 -0
- package/plugin/skills/fix/SKILL.md +62 -0
- package/plugin/skills/frontend-design/.skillfish.json +10 -0
- package/plugin/skills/frontend-design/SKILL.md +42 -0
- package/plugin/skills/gotchas/SKILL.md +61 -0
- package/plugin/skills/graph-orchestrator/SKILL.md +38 -0
- package/plugin/skills/history/SKILL.md +58 -0
- package/plugin/skills/impact/SKILL.md +59 -0
- package/plugin/skills/implementation-execution/SKILL.md +291 -0
- package/plugin/skills/index-repo/SKILL.md +55 -0
- package/plugin/skills/interviewing/SKILL.md +225 -0
- package/plugin/skills/knowledge-curation/SKILL.md +393 -0
- package/plugin/skills/learn/SKILL.md +69 -0
- package/plugin/skills/mcp-integration/.skillfish.json +10 -0
- package/plugin/skills/mcp-integration/SKILL.md +554 -0
- package/plugin/skills/mcp-integration/examples/http-server.json +20 -0
- package/plugin/skills/mcp-integration/examples/sse-server.json +19 -0
- package/plugin/skills/mcp-integration/examples/stdio-server.json +26 -0
- package/plugin/skills/mcp-integration/references/authentication.md +549 -0
- package/plugin/skills/mcp-integration/references/server-types.md +536 -0
- package/plugin/skills/mcp-integration/references/tool-usage.md +538 -0
- package/plugin/skills/nestjs/.skillfish.json +10 -0
- package/plugin/skills/nestjs/SKILL.md +669 -0
- package/plugin/skills/nestjs/drizzle-reference.md +1894 -0
- package/plugin/skills/nestjs/reference.md +1447 -0
- package/plugin/skills/nestjs/workflow-optimization.md +229 -0
- package/plugin/skills/parallel-dispatch/SKILL.md +308 -0
- package/plugin/skills/project-discovery/SKILL.md +304 -0
- package/plugin/skills/search/SKILL.md +56 -0
- package/plugin/skills/security-audit/SKILL.md +362 -0
- package/plugin/skills/skill-development/.skillfish.json +10 -0
- package/plugin/skills/skill-development/SKILL.md +637 -0
- package/plugin/skills/skill-development/references/skill-creator-original.md +209 -0
- package/plugin/skills/tdd/SKILL.md +273 -0
- package/plugin/skills/terminal-presentation/SKILL.md +395 -0
- package/plugin/skills/test-strategy/SKILL.md +365 -0
- package/plugin/skills/verification-protocol/SKILL.md +256 -0
- package/plugin/skills/visual-explainer/CHANGELOG.md +97 -0
- package/plugin/skills/visual-explainer/LICENSE +21 -0
- package/plugin/skills/visual-explainer/README.md +137 -0
- package/plugin/skills/visual-explainer/SKILL.md +352 -0
- package/plugin/skills/visual-explainer/banner.png +0 -0
- package/plugin/skills/visual-explainer/package.json +11 -0
- package/plugin/skills/visual-explainer/prompts/diff-review.md +68 -0
- package/plugin/skills/visual-explainer/prompts/fact-check.md +63 -0
- package/plugin/skills/visual-explainer/prompts/generate-slides.md +18 -0
- package/plugin/skills/visual-explainer/prompts/generate-web-diagram.md +10 -0
- package/plugin/skills/visual-explainer/prompts/plan-review.md +86 -0
- package/plugin/skills/visual-explainer/prompts/project-recap.md +61 -0
- package/plugin/skills/visual-explainer/references/css-patterns.md +1188 -0
- package/plugin/skills/visual-explainer/references/libraries.md +470 -0
- package/plugin/skills/visual-explainer/references/responsive-nav.md +212 -0
- package/plugin/skills/visual-explainer/references/slide-patterns.md +1403 -0
- package/plugin/skills/visual-explainer/templates/architecture.html +596 -0
- package/plugin/skills/visual-explainer/templates/data-table.html +540 -0
- package/plugin/skills/visual-explainer/templates/mermaid-flowchart.html +435 -0
- package/plugin/skills/visual-explainer/templates/slide-deck.html +913 -0
- package/src/cli.ts +655 -0
- package/src/context/.gitkeep +0 -0
- package/src/context/codebase.ts +393 -0
- package/src/context/injector.ts +797 -0
- package/src/context/memory.ts +187 -0
- package/src/context/session-index.ts +327 -0
- package/src/context/session.ts +152 -0
- package/src/index.ts +47 -0
- package/src/ingestion/.gitkeep +0 -0
- package/src/ingestion/chunker.ts +277 -0
- package/src/ingestion/embedder.ts +167 -0
- package/src/ingestion/git-analyzer.ts +545 -0
- package/src/ingestion/indexer.ts +984 -0
- package/src/ingestion/markdown-chunker.ts +337 -0
- package/src/ingestion/markdown-knowledge.ts +175 -0
- package/src/ingestion/parser.ts +475 -0
- package/src/ingestion/watcher.ts +182 -0
- package/src/knowledge/.gitkeep +0 -0
- package/src/knowledge/hydrator.ts +246 -0
- package/src/knowledge/registry.ts +463 -0
- package/src/knowledge/search.ts +565 -0
- package/src/knowledge/store.ts +262 -0
- package/src/learning/.gitkeep +0 -0
- package/src/learning/confidence.ts +193 -0
- package/src/learning/patterns.ts +360 -0
- package/src/learning/trajectory.ts +268 -0
- package/src/memory/.gitkeep +0 -0
- package/src/memory/memory-compat.ts +233 -0
- package/src/memory/observation-store.ts +224 -0
- package/src/memory/session-tracker.ts +332 -0
- package/src/pipeline/.gitkeep +0 -0
- package/src/pipeline/engine.ts +1139 -0
- package/src/pipeline/events.ts +253 -0
- package/src/pipeline/parallel.ts +394 -0
- package/src/pipeline/state-machine.ts +199 -0
- package/src/query/.gitkeep +0 -0
- package/src/query/graph-queries.ts +262 -0
- package/src/query/hybrid-search.ts +337 -0
- package/src/query/intent-detector.ts +131 -0
- package/src/query/ranking.ts +161 -0
- package/src/server.ts +352 -0
- package/src/storage/.gitkeep +0 -0
- package/src/storage/falkordb-store.ts +388 -0
- package/src/storage/file-cache.ts +141 -0
- package/src/storage/interfaces.ts +201 -0
- package/src/storage/qdrant-store.ts +557 -0
- package/src/storage/schema.ts +139 -0
- package/src/storage/sqlite.ts +168 -0
- package/src/tools/.gitkeep +0 -0
- package/src/tools/collaboration-tools.ts +208 -0
- package/src/tools/context-tools.ts +493 -0
- package/src/tools/graph-tools.ts +295 -0
- package/src/tools/ingestion-tools.ts +122 -0
- package/src/tools/learning-tools.ts +181 -0
- package/src/tools/memory-tools.ts +234 -0
- package/src/tools/phase-tools.ts +1452 -0
- package/src/tools/pipeline-tools.ts +188 -0
- package/src/tools/registration-tools.ts +450 -0
- package/src/util/.gitkeep +0 -0
- package/src/util/circuit-breaker.ts +193 -0
- package/src/util/config.ts +177 -0
- package/src/util/logger.ts +53 -0
- package/src/util/token-counter.ts +52 -0
- package/src/util/types.ts +710 -0
- package/tests/context/.gitkeep +0 -0
- package/tests/integration/.gitkeep +0 -0
- package/tests/knowledge/.gitkeep +0 -0
- package/tests/learning/.gitkeep +0 -0
- package/tests/pipeline/.gitkeep +0 -0
- package/tests/tools/.gitkeep +0 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +10 -0
- package/vscode-extension/.vscodeignore +7 -0
- package/vscode-extension/README.md +43 -0
- package/vscode-extension/out/edge-collector.js +274 -0
- package/vscode-extension/out/edge-collector.js.map +1 -0
- package/vscode-extension/out/extension.js +264 -0
- package/vscode-extension/out/extension.js.map +1 -0
- package/vscode-extension/out/forge-client.js +318 -0
- package/vscode-extension/out/forge-client.js.map +1 -0
- package/vscode-extension/package-lock.json +59 -0
- package/vscode-extension/package.json +71 -0
- package/vscode-extension/src/edge-collector.ts +320 -0
- package/vscode-extension/src/extension.ts +269 -0
- package/vscode-extension/src/forge-client.ts +364 -0
- package/vscode-extension/tsconfig.json +19 -0
|
@@ -0,0 +1,1894 @@
|
|
|
1
|
+
### Install Drizzle and Gel Packages
|
|
2
|
+
|
|
3
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
4
|
+
|
|
5
|
+
Installs the necessary Drizzle ORM and Gel packages, along with development dependencies like Drizzle Kit and tsx.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i drizzle-orm gel
|
|
9
|
+
npm i -D drizzle-kit tsx
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
yarn add drizzle-orm gel
|
|
14
|
+
yarn add -D drizzle-kit tsx
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add drizzle-orm gel
|
|
19
|
+
pnpm add -D drizzle-kit tsx
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun add drizzle-orm gel
|
|
24
|
+
bun add -D drizzle-kit tsx
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
--------------------------------
|
|
28
|
+
|
|
29
|
+
### Install Drizzle ORM and Drizzle Kit with bun
|
|
30
|
+
|
|
31
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
32
|
+
|
|
33
|
+
Installs Drizzle ORM and Drizzle Kit using the Bun runtime's package manager, including types for Bun.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bun add drizzle-orm
|
|
37
|
+
bun add -D drizzle-kit @types/bun
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
--------------------------------
|
|
41
|
+
|
|
42
|
+
### Install Drizzle ORM and Drizzle Kit with npm
|
|
43
|
+
|
|
44
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
45
|
+
|
|
46
|
+
Installs the necessary Drizzle ORM package for database operations and Drizzle Kit for schema management and migrations using npm.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm i drizzle-orm
|
|
50
|
+
npm i -D drizzle-kit @types/bun
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
--------------------------------
|
|
54
|
+
|
|
55
|
+
### Install Drizzle ORM and Drizzle Kit with yarn
|
|
56
|
+
|
|
57
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
58
|
+
|
|
59
|
+
Installs the Drizzle ORM and Drizzle Kit packages using yarn, including the types for Bun.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
yarn add drizzle-orm
|
|
63
|
+
yarn add -D drizzle-kit @types/bun
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
--------------------------------
|
|
67
|
+
|
|
68
|
+
### Install Drizzle Packages with bun
|
|
69
|
+
|
|
70
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
71
|
+
|
|
72
|
+
Installs the necessary Drizzle ORM packages, the PlanetScale database driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bun add drizzle-orm @planetscale/database dotenv
|
|
76
|
+
bun add -D drizzle-kit tsx
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
--------------------------------
|
|
80
|
+
|
|
81
|
+
### Install Drizzle ORM and Drizzle Kit with pnpm
|
|
82
|
+
|
|
83
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
84
|
+
|
|
85
|
+
Installs Drizzle ORM and Drizzle Kit, along with Bun types, using the pnpm package manager.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pnpm add drizzle-orm
|
|
89
|
+
pnpm add -D drizzle-kit @types/bun
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
--------------------------------
|
|
93
|
+
|
|
94
|
+
### Install Drizzle Packages with pnpm
|
|
95
|
+
|
|
96
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
97
|
+
|
|
98
|
+
Installs the necessary Drizzle ORM packages, the PlanetScale database driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm add drizzle-orm @planetscale/database dotenv
|
|
102
|
+
pnpm add -D drizzle-kit tsx
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
--------------------------------
|
|
106
|
+
|
|
107
|
+
### Install Drizzle Packages with npm
|
|
108
|
+
|
|
109
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
110
|
+
|
|
111
|
+
Installs the necessary Drizzle ORM packages, the PlanetScale database driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm i drizzle-orm @planetscale/database dotenv
|
|
115
|
+
npm i -D drizzle-kit tsx
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
--------------------------------
|
|
119
|
+
|
|
120
|
+
### Install Drizzle ORM and SQLite Cloud Driver (bun)
|
|
121
|
+
|
|
122
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-cloud-new
|
|
123
|
+
|
|
124
|
+
Installs the necessary Drizzle ORM beta package, the SQLite Cloud driver, dotenv for environment variables, and Drizzle Kit with tsx for development using bun.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
bun add drizzle-orm@beta @sqlitecloud/drivers dotenv
|
|
128
|
+
bun add -D drizzle-kit@beta tsx
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
--------------------------------
|
|
132
|
+
|
|
133
|
+
### Install Drizzle ORM and Supabase Dependencies (bun)
|
|
134
|
+
|
|
135
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
136
|
+
|
|
137
|
+
Installs the necessary Drizzle ORM, postgres driver, dotenv for environment variables, and development tools like drizzle-kit and tsx using bun.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
bun add drizzle-orm postgres dotenv
|
|
141
|
+
bun add -D drizzle-kit tsx
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
--------------------------------
|
|
145
|
+
|
|
146
|
+
### Install Drizzle Packages with yarn
|
|
147
|
+
|
|
148
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
149
|
+
|
|
150
|
+
Installs the necessary Drizzle ORM packages, the PlanetScale database driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
yarn add drizzle-orm @planetscale/database dotenv
|
|
154
|
+
yarn add -D drizzle-kit tsx
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
--------------------------------
|
|
158
|
+
|
|
159
|
+
### Install Drizzle ORM and SQLite Cloud Driver (npm)
|
|
160
|
+
|
|
161
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-cloud-new
|
|
162
|
+
|
|
163
|
+
Installs the necessary Drizzle ORM beta package, the SQLite Cloud driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm i drizzle-orm@beta @sqlitecloud/drivers dotenv
|
|
167
|
+
npm i -D drizzle-kit@beta tsx
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
--------------------------------
|
|
171
|
+
|
|
172
|
+
### Database Connection Setup (Basic)
|
|
173
|
+
|
|
174
|
+
Source: https://orm.drizzle.team/docs/get-started/postgresql-new
|
|
175
|
+
|
|
176
|
+
Initializes Drizzle ORM with a PostgreSQL connection using the DATABASE_URL from environment variables and the node-postgres driver.
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import 'dotenv/config';
|
|
180
|
+
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
181
|
+
|
|
182
|
+
const db = drizzle(process.env.DATABASE_URL!);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
--------------------------------
|
|
186
|
+
|
|
187
|
+
### Install Drizzle ORM and Supabase Dependencies (pnpm)
|
|
188
|
+
|
|
189
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
190
|
+
|
|
191
|
+
Installs the necessary Drizzle ORM, postgres driver, dotenv for environment variables, and development tools like drizzle-kit and tsx using pnpm.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
pnpm add drizzle-orm postgres dotenv
|
|
195
|
+
pnpm add -D drizzle-kit tsx
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
--------------------------------
|
|
199
|
+
|
|
200
|
+
### Install Drizzle ORM and Supabase Dependencies (npm)
|
|
201
|
+
|
|
202
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
203
|
+
|
|
204
|
+
Installs the necessary Drizzle ORM, postgres driver, dotenv for environment variables, and development tools like drizzle-kit and tsx using npm.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npm i drizzle-orm postgres dotenv
|
|
208
|
+
npm i -D drizzle-kit tsx
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
--------------------------------
|
|
212
|
+
|
|
213
|
+
### Install Drizzle ORM and SQLite Cloud Driver (pnpm)
|
|
214
|
+
|
|
215
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-cloud-new
|
|
216
|
+
|
|
217
|
+
Installs the necessary Drizzle ORM beta package, the SQLite Cloud driver, dotenv for environment variables, and Drizzle Kit with tsx for development using pnpm.
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
pnpm add drizzle-orm@beta @sqlitecloud/drivers dotenv
|
|
221
|
+
pnpm add -D drizzle-kit@beta tsx
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
--------------------------------
|
|
225
|
+
|
|
226
|
+
### Install Drizzle ORM and SQLite Cloud Driver (yarn)
|
|
227
|
+
|
|
228
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-cloud-new
|
|
229
|
+
|
|
230
|
+
Installs the necessary Drizzle ORM beta package, the SQLite Cloud driver, dotenv for environment variables, and Drizzle Kit with tsx for development using yarn.
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
yarn add drizzle-orm@beta @sqlitecloud/drivers dotenv
|
|
234
|
+
yarn add -D drizzle-kit@beta tsx
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
--------------------------------
|
|
238
|
+
|
|
239
|
+
### Install Drizzle Packages (bun)
|
|
240
|
+
|
|
241
|
+
Source: https://orm.drizzle.team/docs/get-started/vercel-new
|
|
242
|
+
|
|
243
|
+
Installs the necessary Drizzle ORM packages and development tools using bun. This includes the core Drizzle ORM library, the Vercel Postgres driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
bun add drizzle-orm @vercel/postgres dotenv
|
|
247
|
+
bun add -D drizzle-kit tsx
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
--------------------------------
|
|
251
|
+
|
|
252
|
+
### Install Drizzle ORM and Supabase Dependencies (yarn)
|
|
253
|
+
|
|
254
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
255
|
+
|
|
256
|
+
Installs the necessary Drizzle ORM, postgres driver, dotenv for environment variables, and development tools like drizzle-kit and tsx using yarn.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
yarn add drizzle-orm postgres dotenv
|
|
260
|
+
yarn add -D drizzle-kit tsx
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
--------------------------------
|
|
264
|
+
|
|
265
|
+
### Initialize Gel Project
|
|
266
|
+
|
|
267
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
268
|
+
|
|
269
|
+
Initializes a new Gel project. This command is used to set up the basic structure for a Gel database project.
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
npx gel project init
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
yarn gel project init
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
pnpm gel project init
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
bunx gel project init
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
--------------------------------
|
|
288
|
+
|
|
289
|
+
### Install Drizzle ORM and TiDB Serverless Packages (bun)
|
|
290
|
+
|
|
291
|
+
Source: https://orm.drizzle.team/docs/connect-tidb
|
|
292
|
+
|
|
293
|
+
Installs the necessary Drizzle ORM and TiDB Serverless packages using bun. It also installs drizzle-kit as a development dependency for schema management and migrations.
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
bun add drizzle-orm @tidbcloud/serverless
|
|
297
|
+
bun add -D drizzle-kit
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
--------------------------------
|
|
301
|
+
|
|
302
|
+
### PostgreSQL Connection URL Example
|
|
303
|
+
|
|
304
|
+
Source: https://orm.drizzle.team/docs/guides/postgresql-local-setup
|
|
305
|
+
|
|
306
|
+
This is the standard format for a PostgreSQL database connection URL. Replace the placeholders with your specific credentials and host information.
|
|
307
|
+
|
|
308
|
+
```sql
|
|
309
|
+
postgres://:@:/
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```sql
|
|
313
|
+
postgres://postgres:mypassword@localhost:5432/postgres
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
--------------------------------
|
|
317
|
+
|
|
318
|
+
### Drizzle Kit Configuration for PostgreSQL
|
|
319
|
+
|
|
320
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
321
|
+
|
|
322
|
+
Configuration file for Drizzle Kit, specifying the output directory for migrations, the schema file location, the database dialect (PostgreSQL), and database credentials.
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
import 'dotenv/config';
|
|
326
|
+
import { defineConfig } from 'drizzle-kit';
|
|
327
|
+
|
|
328
|
+
export default defineConfig({
|
|
329
|
+
out: './drizzle',
|
|
330
|
+
schema: './src/db/schema.ts',
|
|
331
|
+
dialect: 'postgresql',
|
|
332
|
+
dbCredentials: {
|
|
333
|
+
url: process.env.DATABASE_URL!,
|
|
334
|
+
},
|
|
335
|
+
});
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
--------------------------------
|
|
339
|
+
|
|
340
|
+
### Install Drizzle ORM and Drizzle Kit Packages
|
|
341
|
+
|
|
342
|
+
Source: https://orm.drizzle.team/docs/connect-cloudflare-d1
|
|
343
|
+
|
|
344
|
+
Installs the necessary Drizzle ORM and Drizzle Kit packages for project setup. Drizzle ORM is used for database interactions, while Drizzle Kit provides tooling for schema management and migrations.
|
|
345
|
+
|
|
346
|
+
```npm
|
|
347
|
+
npm i drizzle-orm
|
|
348
|
+
npm i -D drizzle-kit
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
```yarn
|
|
352
|
+
yarn add drizzle-orm
|
|
353
|
+
yarn add -D drizzle-kit
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
```pnpm
|
|
357
|
+
pnpm add drizzle-orm
|
|
358
|
+
pnpm add -D drizzle-kit
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
```bun
|
|
362
|
+
bun add drizzle-orm
|
|
363
|
+
bun add -D drizzle-kit
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
--------------------------------
|
|
367
|
+
|
|
368
|
+
### Configure MySQL Database URL
|
|
369
|
+
|
|
370
|
+
Source: https://orm.drizzle.team/docs/guides/mysql-local-setup
|
|
371
|
+
|
|
372
|
+
This is the standard format for a MySQL connection URL. Replace the placeholders with your specific credentials and host information. The example provided shows how to construct the URL for the previously started Docker container.
|
|
373
|
+
|
|
374
|
+
```plaintext
|
|
375
|
+
mysql://:@:/
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
```plaintext
|
|
379
|
+
mysql://root:mypassword@localhost:3306/mysql
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
--------------------------------
|
|
383
|
+
|
|
384
|
+
### Database Connection Setup (with Config)
|
|
385
|
+
|
|
386
|
+
Source: https://orm.drizzle.team/docs/get-started/postgresql-new
|
|
387
|
+
|
|
388
|
+
Initializes Drizzle ORM with a PostgreSQL connection, passing specific node-postgres connection options like SSL configuration.
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
import 'dotenv/config';
|
|
392
|
+
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
393
|
+
|
|
394
|
+
// You can specify any property from the node-postgres connection options
|
|
395
|
+
const db = drizzle({
|
|
396
|
+
connection: {
|
|
397
|
+
connectionString: process.env.DATABASE_URL!,
|
|
398
|
+
ssl: true
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
--------------------------------
|
|
404
|
+
|
|
405
|
+
### Install Drizzle ORM and Drizzle Kit with npm/yarn/pnpm/bun
|
|
406
|
+
|
|
407
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sqlite-new
|
|
408
|
+
|
|
409
|
+
Commands to install Drizzle ORM and Drizzle Kit, essential for ORM functionality and schema management. Drizzle Kit requires @types/bun for TypeScript projects.
|
|
410
|
+
|
|
411
|
+
```npm
|
|
412
|
+
npm i drizzle-orm
|
|
413
|
+
npm i -D drizzle-kit @types/bun
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
```yarn
|
|
417
|
+
yarn add drizzle-orm
|
|
418
|
+
yarn add -D drizzle-kit @types/bun
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
```pnpm
|
|
422
|
+
pnpm add drizzle-orm
|
|
423
|
+
pnpm add -D drizzle-kit @types/bun
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
```bun
|
|
427
|
+
bun add drizzle-orm
|
|
428
|
+
bun add -D drizzle-kit @types/bun
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
--------------------------------
|
|
432
|
+
|
|
433
|
+
### Run Docker Container with User and Database
|
|
434
|
+
|
|
435
|
+
Source: https://orm.drizzle.team/docs/guides/postgresql-local-setup
|
|
436
|
+
|
|
437
|
+
This shows how to start a PostgreSQL container with a specific user and database name. If not provided, default values are used.
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
docker run --name drizzle-postgres -e POSTGRES_USER=myuser -e POSTGRES_PASSWORD=mypassword -e POSTGRES_DB=mydatabase -d -p 5432:5432 postgres
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
--------------------------------
|
|
444
|
+
|
|
445
|
+
### Install Drizzle Packages (npm)
|
|
446
|
+
|
|
447
|
+
Source: https://orm.drizzle.team/docs/get-started/vercel-new
|
|
448
|
+
|
|
449
|
+
Installs the necessary Drizzle ORM packages and development tools using npm. This includes the core Drizzle ORM library, the Vercel Postgres driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
npm i drizzle-orm @vercel/postgres dotenv
|
|
453
|
+
npm i -D drizzle-kit tsx
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
--------------------------------
|
|
457
|
+
|
|
458
|
+
### Project File Structure for Drizzle ORM
|
|
459
|
+
|
|
460
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
461
|
+
|
|
462
|
+
Basic file structure for a Drizzle ORM project using Bun SQL. It shows the location of schema definitions, migration files, configuration files, and environment variables.
|
|
463
|
+
|
|
464
|
+
```tree
|
|
465
|
+
📦
|
|
466
|
+
├ 📂 drizzle
|
|
467
|
+
├ 📂 src
|
|
468
|
+
│ ├ 📂 db
|
|
469
|
+
│ │ └ 📜 schema.ts
|
|
470
|
+
│ └ 📜 index.ts
|
|
471
|
+
├ 📜 .env
|
|
472
|
+
├ 📜 drizzle.config.ts
|
|
473
|
+
├ 📜 package.json
|
|
474
|
+
└ 📜 tsconfig.json
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
--------------------------------
|
|
478
|
+
|
|
479
|
+
### Install Drizzle ORM and MySQL2 Dependencies (npm)
|
|
480
|
+
|
|
481
|
+
Source: https://orm.drizzle.team/docs/get-started/mysql-new
|
|
482
|
+
|
|
483
|
+
Installs the necessary Drizzle ORM packages, the mysql2 driver, dotenv for environment variables, and drizzle-kit and tsx for development.
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
npm i drizzle-orm mysql2 dotenv
|
|
487
|
+
npm i -D drizzle-kit tsx
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
--------------------------------
|
|
491
|
+
|
|
492
|
+
### Configure Drizzle Kit
|
|
493
|
+
|
|
494
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
495
|
+
|
|
496
|
+
Sets up the Drizzle Kit configuration file. This TypeScript file specifies the database dialect and other project-specific settings for Drizzle Kit.
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
import { defineConfig } from 'drizzle-kit';
|
|
500
|
+
|
|
501
|
+
export default defineConfig({
|
|
502
|
+
dialect: 'gel',
|
|
503
|
+
});
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
--------------------------------
|
|
507
|
+
|
|
508
|
+
### Install Drizzle ORM and MySQL2 Dependencies (bun)
|
|
509
|
+
|
|
510
|
+
Source: https://orm.drizzle.team/docs/get-started/mysql-new
|
|
511
|
+
|
|
512
|
+
Installs the necessary Drizzle ORM packages, the mysql2 driver, dotenv for environment variables, and drizzle-kit and tsx for development using Bun.
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
bun add drizzle-orm mysql2 dotenv
|
|
516
|
+
bun add -D drizzle-kit tsx
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
--------------------------------
|
|
520
|
+
|
|
521
|
+
### Install Drizzle Packages (pnpm)
|
|
522
|
+
|
|
523
|
+
Source: https://orm.drizzle.team/docs/get-started/vercel-new
|
|
524
|
+
|
|
525
|
+
Installs the necessary Drizzle ORM packages and development tools using pnpm. This includes the core Drizzle ORM library, the Vercel Postgres driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
pnpm add drizzle-orm @vercel/postgres dotenv
|
|
529
|
+
pnpm add -D drizzle-kit tsx
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
--------------------------------
|
|
533
|
+
|
|
534
|
+
### Setup SQLite Cloud Connection String
|
|
535
|
+
|
|
536
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-cloud-new
|
|
537
|
+
|
|
538
|
+
Defines the environment variable for the SQLite Cloud database connection string in the .env file.
|
|
539
|
+
|
|
540
|
+
```dotenv
|
|
541
|
+
SQLITE_CLOUD_CONNECTION_STRING=
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
--------------------------------
|
|
545
|
+
|
|
546
|
+
### Install Drizzle ORM and Dependencies (bun)
|
|
547
|
+
|
|
548
|
+
Source: https://orm.drizzle.team/docs/get-started/turso-database-new
|
|
549
|
+
|
|
550
|
+
Installs the essential Drizzle ORM packages and development tools using bun. This command includes the beta versions of `drizzle-orm` and `drizzle-kit`, as well as `@tursodatabase/database`, `dotenv`, and `tsx` for the project.
|
|
551
|
+
|
|
552
|
+
```bash
|
|
553
|
+
bun add drizzle-orm@beta @tursodatabase/database dotenv
|
|
554
|
+
bun add -D drizzle-kit@beta tsx
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
--------------------------------
|
|
558
|
+
|
|
559
|
+
### Install Drizzle ORM and Dependencies (bun)
|
|
560
|
+
|
|
561
|
+
Source: https://orm.drizzle.team/docs/get-started/d1-new
|
|
562
|
+
|
|
563
|
+
Installs the necessary Drizzle ORM packages and development tools using bun. `drizzle-orm` and `dotenv` are for runtime, while `drizzle-kit` and `tsx` are for development.
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
bun add drizzle-orm dotenv
|
|
567
|
+
bun add -D drizzle-kit tsx
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
--------------------------------
|
|
571
|
+
|
|
572
|
+
### Install Drizzle ORM and Neon Packages (bun)
|
|
573
|
+
|
|
574
|
+
Source: https://orm.drizzle.team/docs/get-started/neon-new
|
|
575
|
+
|
|
576
|
+
Installs the core Drizzle ORM package, the Neon serverless driver, dotenv for environment variables, and development tools like Drizzle Kit and tsx using bun.
|
|
577
|
+
|
|
578
|
+
```bash
|
|
579
|
+
bun add drizzle-orm @neondatabase/serverless dotenv
|
|
580
|
+
bun add -D drizzle-kit tsx
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
--------------------------------
|
|
584
|
+
|
|
585
|
+
### Configure Drizzle Kit
|
|
586
|
+
|
|
587
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-cloud-new
|
|
588
|
+
|
|
589
|
+
Sets up the Drizzle Kit configuration file, specifying the migration output directory, schema file location, dialect, and database credentials.
|
|
590
|
+
|
|
591
|
+
```typescript
|
|
592
|
+
import 'dotenv/config';
|
|
593
|
+
import { defineConfig } from 'drizzle-kit';
|
|
594
|
+
|
|
595
|
+
export default defineConfig({
|
|
596
|
+
out: './drizzle',
|
|
597
|
+
schema: './src/db/schema.ts',
|
|
598
|
+
dialect: 'sqlite',
|
|
599
|
+
dbCredentials: {
|
|
600
|
+
url: process.env.SQLITE_CLOUD_CONNECTION_STRING!,
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
--------------------------------
|
|
606
|
+
|
|
607
|
+
### Database Connection Setup (using Pool)
|
|
608
|
+
|
|
609
|
+
Source: https://orm.drizzle.team/docs/get-started/postgresql-new
|
|
610
|
+
|
|
611
|
+
Initializes Drizzle ORM with a PostgreSQL connection managed by a node-postgres Pool, allowing for connection pooling.
|
|
612
|
+
|
|
613
|
+
```typescript
|
|
614
|
+
import 'dotenv/config';
|
|
615
|
+
import { drizzle } from "drizzle-orm/node-postgres";
|
|
616
|
+
import { Pool } from "pg";
|
|
617
|
+
|
|
618
|
+
const pool = new Pool({
|
|
619
|
+
connectionString: process.env.DATABASE_URL!,
|
|
620
|
+
});
|
|
621
|
+
const db = drizzle({ client: pool });
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
--------------------------------
|
|
625
|
+
|
|
626
|
+
### Install Drizzle ORM and Neon Serverless Driver (bun)
|
|
627
|
+
|
|
628
|
+
Source: https://orm.drizzle.team/docs/connect-neon
|
|
629
|
+
|
|
630
|
+
Installs the Drizzle ORM and the Neon serverless driver using bun. Also installs drizzle-kit as a development dependency.
|
|
631
|
+
|
|
632
|
+
```bash
|
|
633
|
+
bun add drizzle-orm @neondatabase/serverless
|
|
634
|
+
bun add -D drizzle-kit
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
--------------------------------
|
|
638
|
+
|
|
639
|
+
### Install Drizzle Packages (yarn)
|
|
640
|
+
|
|
641
|
+
Source: https://orm.drizzle.team/docs/get-started/vercel-new
|
|
642
|
+
|
|
643
|
+
Installs the necessary Drizzle ORM packages and development tools using yarn. This includes the core Drizzle ORM library, the Vercel Postgres driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
644
|
+
|
|
645
|
+
```bash
|
|
646
|
+
yarn add drizzle-orm @vercel/postgres dotenv
|
|
647
|
+
yarn add -D drizzle-kit tsx
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
--------------------------------
|
|
651
|
+
|
|
652
|
+
### Install Drizzle ORM and Neon Serverless Driver (npm)
|
|
653
|
+
|
|
654
|
+
Source: https://orm.drizzle.team/docs/connect-neon
|
|
655
|
+
|
|
656
|
+
Installs the Drizzle ORM and the Neon serverless driver using npm. Also installs drizzle-kit as a development dependency.
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
npm i drizzle-orm @neondatabase/serverless
|
|
660
|
+
npm i -D drizzle-kit
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
--------------------------------
|
|
664
|
+
|
|
665
|
+
### Install Drizzle ORM and MySQL2 Dependencies (pnpm)
|
|
666
|
+
|
|
667
|
+
Source: https://orm.drizzle.team/docs/get-started/mysql-new
|
|
668
|
+
|
|
669
|
+
Installs the necessary Drizzle ORM packages, the mysql2 driver, dotenv for environment variables, and drizzle-kit and tsx for development using pnpm.
|
|
670
|
+
|
|
671
|
+
```bash
|
|
672
|
+
pnpm add drizzle-orm mysql2 dotenv
|
|
673
|
+
pnpm add -D drizzle-kit tsx
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
--------------------------------
|
|
677
|
+
|
|
678
|
+
### Install Drizzle ORM and Dependencies (npm)
|
|
679
|
+
|
|
680
|
+
Source: https://orm.drizzle.team/docs/get-started/turso-database-new
|
|
681
|
+
|
|
682
|
+
Installs the necessary Drizzle ORM packages and development tools using npm. It includes the beta versions of `drizzle-orm` and `drizzle-kit`, along with `@tursodatabase/database`, `dotenv`, and `tsx` for development.
|
|
683
|
+
|
|
684
|
+
```bash
|
|
685
|
+
npm i drizzle-orm@beta @tursodatabase/database dotenv
|
|
686
|
+
npm i -D drizzle-kit@beta tsx
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
--------------------------------
|
|
690
|
+
|
|
691
|
+
### Install Drizzle ORM and TiDB Serverless Packages (npm)
|
|
692
|
+
|
|
693
|
+
Source: https://orm.drizzle.team/docs/connect-tidb
|
|
694
|
+
|
|
695
|
+
Installs the necessary Drizzle ORM and TiDB Serverless packages using npm. It also installs drizzle-kit as a development dependency for schema management and migrations.
|
|
696
|
+
|
|
697
|
+
```bash
|
|
698
|
+
npm i drizzle-orm @tidbcloud/serverless
|
|
699
|
+
npm i -D drizzle-kit
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
--------------------------------
|
|
703
|
+
|
|
704
|
+
### Seeding and Querying Database with Drizzle ORM (TypeScript)
|
|
705
|
+
|
|
706
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
707
|
+
|
|
708
|
+
Demonstrates how to interact with a PostgreSQL database using Drizzle ORM in TypeScript. It includes operations for inserting a new user, selecting all users, updating a user's age, and deleting a user. This example assumes a `usersTable` schema and uses environment variables for database connection.
|
|
709
|
+
|
|
710
|
+
```typescript
|
|
711
|
+
import 'dotenv/config';
|
|
712
|
+
import { drizzle } from 'drizzle-orm/postgres-js';
|
|
713
|
+
import { eq } from 'drizzle-orm';
|
|
714
|
+
import { usersTable } from './db/schema';
|
|
715
|
+
|
|
716
|
+
const db = drizzle(process.env.DATABASE_URL!);
|
|
717
|
+
|
|
718
|
+
async function main() {
|
|
719
|
+
const user: typeof usersTable.$inferInsert = {
|
|
720
|
+
name: 'John',
|
|
721
|
+
age: 30,
|
|
722
|
+
email: 'john@example.com',
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
await db.insert(usersTable).values(user);
|
|
726
|
+
console.log('New user created!')
|
|
727
|
+
|
|
728
|
+
const users = await db.select().from(usersTable);
|
|
729
|
+
console.log('Getting all users from the database: ', users)
|
|
730
|
+
/*
|
|
731
|
+
const users: {
|
|
732
|
+
id: number;
|
|
733
|
+
name: string;
|
|
734
|
+
age: number;
|
|
735
|
+
email: string;
|
|
736
|
+
}[]
|
|
737
|
+
*/
|
|
738
|
+
|
|
739
|
+
await db
|
|
740
|
+
.update(usersTable)
|
|
741
|
+
.set({
|
|
742
|
+
age: 31,
|
|
743
|
+
})
|
|
744
|
+
.where(eq(usersTable.email, user.email));
|
|
745
|
+
console.log('User info updated!')
|
|
746
|
+
|
|
747
|
+
await db.delete(usersTable).where(eq(usersTable.email, user.email));
|
|
748
|
+
console.log('User deleted!')
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
main();
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
--------------------------------
|
|
755
|
+
|
|
756
|
+
### Install Drizzle ORM and SQLite Packages (bun)
|
|
757
|
+
|
|
758
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-new
|
|
759
|
+
|
|
760
|
+
Installs the necessary Drizzle ORM, libsql client, dotenv, and development packages using bun. This command is for setting up a new project or adding dependencies to an existing one.
|
|
761
|
+
|
|
762
|
+
```bash
|
|
763
|
+
bun add drizzle-orm @libsql/client dotenv
|
|
764
|
+
bun add -D drizzle-kit tsx
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
--------------------------------
|
|
768
|
+
|
|
769
|
+
### Manage Gel Migrations
|
|
770
|
+
|
|
771
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
772
|
+
|
|
773
|
+
Commands to manage Gel database migrations. 'migration create' generates a migration file, and 'migration apply' applies pending migrations to the database.
|
|
774
|
+
|
|
775
|
+
```bash
|
|
776
|
+
gel migration create
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
```bash
|
|
780
|
+
gel migration apply
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
--------------------------------
|
|
784
|
+
|
|
785
|
+
### Initialize Drizzle ORM with Bun SQL
|
|
786
|
+
|
|
787
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
788
|
+
|
|
789
|
+
Initializes the Drizzle ORM instance using the connection URL from the environment variables for Bun SQL.
|
|
790
|
+
|
|
791
|
+
```typescript
|
|
792
|
+
import 'dotenv/config';
|
|
793
|
+
import { drizzle } from 'drizzle-orm/bun-sql';
|
|
794
|
+
|
|
795
|
+
const db = drizzle(process.env.DATABASE_URL!);
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
--------------------------------
|
|
799
|
+
|
|
800
|
+
### Install Drizzle ORM and TiDB Serverless Packages (pnpm)
|
|
801
|
+
|
|
802
|
+
Source: https://orm.drizzle.team/docs/connect-tidb
|
|
803
|
+
|
|
804
|
+
Installs the necessary Drizzle ORM and TiDB Serverless packages using pnpm. It also installs drizzle-kit as a development dependency for schema management and migrations.
|
|
805
|
+
|
|
806
|
+
```bash
|
|
807
|
+
pnpm add drizzle-orm @tidbcloud/serverless
|
|
808
|
+
pnpm add -D drizzle-kit
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
--------------------------------
|
|
812
|
+
|
|
813
|
+
### Install Drizzle and PGlite Packages (npm, yarn, pnpm, bun)
|
|
814
|
+
|
|
815
|
+
Source: https://orm.drizzle.team/docs/get-started/pglite-new
|
|
816
|
+
|
|
817
|
+
Provides commands to install the necessary Drizzle ORM packages, the PGlite driver, dotenv for environment variables, and Drizzle Kit with tsx for development.
|
|
818
|
+
|
|
819
|
+
```bash
|
|
820
|
+
npm i drizzle-orm @electric-sql/pglite dotenv
|
|
821
|
+
npm i -D drizzle-kit tsx
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
```bash
|
|
825
|
+
yarn add drizzle-orm @electric-sql/pglite dotenv
|
|
826
|
+
yarn add -D drizzle-kit tsx
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
```bash
|
|
830
|
+
pnpm add drizzle-orm @electric-sql/pglite dotenv
|
|
831
|
+
pnpm add -D drizzle-kit tsx
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
```bash
|
|
835
|
+
bun add drizzle-orm @electric-sql/pglite dotenv
|
|
836
|
+
bun add -D drizzle-kit tsx
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
--------------------------------
|
|
840
|
+
|
|
841
|
+
### Initialize Drizzle ORM Connection (Async)
|
|
842
|
+
|
|
843
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
844
|
+
|
|
845
|
+
Initializes an asynchronous Drizzle ORM connection using the 'postgres-js' driver and the DATABASE_URL from environment variables.
|
|
846
|
+
|
|
847
|
+
```typescript
|
|
848
|
+
import { drizzle } from 'drizzle-orm'
|
|
849
|
+
|
|
850
|
+
async function main() {
|
|
851
|
+
const db = drizzle('postgres-js', process.env.DATABASE_URL);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
main();
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
--------------------------------
|
|
858
|
+
|
|
859
|
+
### Generate and Apply Database Migrations with drizzle-kit
|
|
860
|
+
|
|
861
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
862
|
+
|
|
863
|
+
Generates SQL migration files based on schema changes and then applies these migrations to the database. This process is managed via separate commands.
|
|
864
|
+
|
|
865
|
+
```bash
|
|
866
|
+
npx drizzle-kit generate
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
```bash
|
|
870
|
+
npx drizzle-kit migrate
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
--------------------------------
|
|
874
|
+
|
|
875
|
+
### Install Drizzle ORM and MySQL2 Dependencies (yarn)
|
|
876
|
+
|
|
877
|
+
Source: https://orm.drizzle.team/docs/get-started/mysql-new
|
|
878
|
+
|
|
879
|
+
Installs the necessary Drizzle ORM packages, the mysql2 driver, dotenv for environment variables, and drizzle-kit and tsx for development using Yarn.
|
|
880
|
+
|
|
881
|
+
```bash
|
|
882
|
+
yarn add drizzle-orm mysql2 dotenv
|
|
883
|
+
yarn add -D drizzle-kit tsx
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
--------------------------------
|
|
887
|
+
|
|
888
|
+
### List Docker Images
|
|
889
|
+
|
|
890
|
+
Source: https://orm.drizzle.team/docs/guides/postgresql-local-setup
|
|
891
|
+
|
|
892
|
+
After pulling an image, this command lists all downloaded Docker images on your system, allowing you to verify the PostgreSQL image and its details.
|
|
893
|
+
|
|
894
|
+
```bash
|
|
895
|
+
docker images
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
--------------------------------
|
|
899
|
+
|
|
900
|
+
### Turso CLI: Authenticate and Create Database
|
|
901
|
+
|
|
902
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-turso
|
|
903
|
+
|
|
904
|
+
Commands to authenticate with the Turso service and create a new database. Requires Turso CLI installation. The database name 'drizzle-turso-db' is used as an example.
|
|
905
|
+
|
|
906
|
+
```bash
|
|
907
|
+
turso auth signup
|
|
908
|
+
turso auth login
|
|
909
|
+
turso db create drizzle-turso-db
|
|
910
|
+
turso db show drizzle-turso-db
|
|
911
|
+
turso db tokens create drizzle-turso-db
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
--------------------------------
|
|
915
|
+
|
|
916
|
+
### Install Drizzle ORM and Neon Packages (npm)
|
|
917
|
+
|
|
918
|
+
Source: https://orm.drizzle.team/docs/get-started/neon-new
|
|
919
|
+
|
|
920
|
+
Installs the core Drizzle ORM package, the Neon serverless driver, dotenv for environment variables, and development tools like Drizzle Kit and tsx using npm.
|
|
921
|
+
|
|
922
|
+
```bash
|
|
923
|
+
npm i drizzle-orm @neondatabase/serverless dotenv
|
|
924
|
+
npm i -D drizzle-kit tsx
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
--------------------------------
|
|
928
|
+
|
|
929
|
+
### Start Netlify Development Server
|
|
930
|
+
|
|
931
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-netlify-edge-functions-neon
|
|
932
|
+
|
|
933
|
+
Launches the Netlify dev server for local testing of edge functions and site deployment. This command allows for simulating the Netlify environment locally.
|
|
934
|
+
|
|
935
|
+
```bash
|
|
936
|
+
netlify dev
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
--------------------------------
|
|
940
|
+
|
|
941
|
+
### Install Drizzle ORM and Neon Serverless Driver (pnpm)
|
|
942
|
+
|
|
943
|
+
Source: https://orm.drizzle.team/docs/connect-neon
|
|
944
|
+
|
|
945
|
+
Installs the Drizzle ORM and the Neon serverless driver using pnpm. Also installs drizzle-kit as a development dependency.
|
|
946
|
+
|
|
947
|
+
```bash
|
|
948
|
+
pnpm add drizzle-orm @neondatabase/serverless
|
|
949
|
+
pnpm add -D drizzle-kit
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
--------------------------------
|
|
953
|
+
|
|
954
|
+
### SQL Generated Migration File Example
|
|
955
|
+
|
|
956
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-turso
|
|
957
|
+
|
|
958
|
+
An example of a SQL file generated by Drizzle Kit for database migrations. It includes CREATE TABLE statements for 'posts' and 'users', defining their columns, constraints, foreign keys, and unique indexes.
|
|
959
|
+
|
|
960
|
+
```sql
|
|
961
|
+
CREATE TABLE `posts` (
|
|
962
|
+
`id` integer PRIMARY KEY NOT NULL,
|
|
963
|
+
`title` text NOT NULL,
|
|
964
|
+
`content` text NOT NULL,
|
|
965
|
+
`user_id` integer NOT NULL,
|
|
966
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
967
|
+
`updated_at` integer,
|
|
968
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
969
|
+
);
|
|
970
|
+
--> statement-breakpoint
|
|
971
|
+
CREATE TABLE `users` (
|
|
972
|
+
`id` integer PRIMARY KEY NOT NULL,
|
|
973
|
+
`name` text NOT NULL,
|
|
974
|
+
`age` integer NOT NULL,
|
|
975
|
+
`email` text NOT NULL
|
|
976
|
+
);
|
|
977
|
+
--> statement-breakpoint
|
|
978
|
+
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
--------------------------------
|
|
982
|
+
|
|
983
|
+
### Run TypeScript Script with Bun
|
|
984
|
+
|
|
985
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
986
|
+
|
|
987
|
+
Executes a TypeScript file using the Bun runtime environment. This command is used to run the main application script after setting up database operations.
|
|
988
|
+
|
|
989
|
+
```bash
|
|
990
|
+
bun src/index.ts
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
--------------------------------
|
|
994
|
+
|
|
995
|
+
### Initialize New Netlify Project
|
|
996
|
+
|
|
997
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-netlify-edge-functions-neon
|
|
998
|
+
|
|
999
|
+
Initializes a new Netlify project using the Netlify CLI. This command guides the user through setting up a new site and choosing deployment options.
|
|
1000
|
+
|
|
1001
|
+
```bash
|
|
1002
|
+
netlify init
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
--------------------------------
|
|
1006
|
+
|
|
1007
|
+
### Install Drizzle ORM and Neon Packages (pnpm)
|
|
1008
|
+
|
|
1009
|
+
Source: https://orm.drizzle.team/docs/get-started/neon-new
|
|
1010
|
+
|
|
1011
|
+
Installs the core Drizzle ORM package, the Neon serverless driver, dotenv for environment variables, and development tools like Drizzle Kit and tsx using pnpm.
|
|
1012
|
+
|
|
1013
|
+
```bash
|
|
1014
|
+
pnpm add drizzle-orm @neondatabase/serverless dotenv
|
|
1015
|
+
pnpm add -D drizzle-kit tsx
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
--------------------------------
|
|
1019
|
+
|
|
1020
|
+
### Generated Drizzle Schema for Gel
|
|
1021
|
+
|
|
1022
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
1023
|
+
|
|
1024
|
+
Example of a schema file generated by Drizzle Kit after pulling from a Gel database. It defines a 'users' table with UUID, smallint, and text fields.
|
|
1025
|
+
|
|
1026
|
+
```typescript
|
|
1027
|
+
import { gelTable, uniqueIndex, uuid, smallint, text } from "drizzle-orm/gel-core"
|
|
1028
|
+
import { sql } from "drizzle-orm"
|
|
1029
|
+
|
|
1030
|
+
export const users = gelTable("users", {
|
|
1031
|
+
id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(),
|
|
1032
|
+
age: smallint(),
|
|
1033
|
+
email: text().notNull(),
|
|
1034
|
+
name: text(),
|
|
1035
|
+
}, (table) => [
|
|
1036
|
+
uniqueIndex("a8c6061c-f37f-11ef-9249-0d78f6c1807b;schemaconstr").using("btree", table.id.asc().nullsLast().op("uuid_ops")),
|
|
1037
|
+
]);
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
--------------------------------
|
|
1041
|
+
|
|
1042
|
+
### Install Drizzle ORM and SQLite Packages (pnpm)
|
|
1043
|
+
|
|
1044
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-new
|
|
1045
|
+
|
|
1046
|
+
Installs the necessary Drizzle ORM, libsql client, dotenv, and development packages using pnpm. This command is for setting up a new project or adding dependencies to an existing one.
|
|
1047
|
+
|
|
1048
|
+
```bash
|
|
1049
|
+
pnpm add drizzle-orm @libsql/client dotenv
|
|
1050
|
+
pnpm add -D drizzle-kit tsx
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
--------------------------------
|
|
1054
|
+
|
|
1055
|
+
### Install Drizzle ORM and TiDB Serverless Packages (yarn)
|
|
1056
|
+
|
|
1057
|
+
Source: https://orm.drizzle.team/docs/connect-tidb
|
|
1058
|
+
|
|
1059
|
+
Installs the necessary Drizzle ORM and TiDB Serverless packages using yarn. It also installs drizzle-kit as a development dependency for schema management and migrations.
|
|
1060
|
+
|
|
1061
|
+
```bash
|
|
1062
|
+
yarn add drizzle-orm @tidbcloud/serverless
|
|
1063
|
+
yarn add -D drizzle-kit
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
--------------------------------
|
|
1067
|
+
|
|
1068
|
+
### Install Drizzle ORM and Vercel Postgres Packages
|
|
1069
|
+
|
|
1070
|
+
Source: https://orm.drizzle.team/docs/connect-vercel-postgres
|
|
1071
|
+
|
|
1072
|
+
Installs the Drizzle ORM and the Vercel Postgres driver using npm, yarn, pnpm, or bun. Also installs drizzle-kit as a development dependency.
|
|
1073
|
+
|
|
1074
|
+
```npm
|
|
1075
|
+
npm i drizzle-orm @vercel/postgres
|
|
1076
|
+
npm i -D drizzle-kit
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
```yarn
|
|
1080
|
+
yarn add drizzle-orm @vercel/postgres
|
|
1081
|
+
yarn add -D drizzle-kit
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
```pnpm
|
|
1085
|
+
pnpm add drizzle-orm @vercel/postgres
|
|
1086
|
+
pnpm add -D drizzle-kit
|
|
1087
|
+
```
|
|
1088
|
+
|
|
1089
|
+
```bun
|
|
1090
|
+
bun add drizzle-orm @vercel/postgres
|
|
1091
|
+
bun add -D drizzle-kit
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
--------------------------------
|
|
1095
|
+
|
|
1096
|
+
### Initialize Drizzle ORM with Bun SQL Connection Options
|
|
1097
|
+
|
|
1098
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
1099
|
+
|
|
1100
|
+
Initializes Drizzle ORM with specific connection options for Bun SQL, allowing configuration of the connection object.
|
|
1101
|
+
|
|
1102
|
+
```typescript
|
|
1103
|
+
import 'dotenv/config';
|
|
1104
|
+
import { drizzle } from 'drizzle-orm/bun-sql';
|
|
1105
|
+
|
|
1106
|
+
// You can specify any property from the bun sql connection options
|
|
1107
|
+
const db = drizzle({ connection: { url: process.env.DATABASE_URL! }});
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
--------------------------------
|
|
1111
|
+
|
|
1112
|
+
### Install Drizzle ORM and Dependencies (pnpm)
|
|
1113
|
+
|
|
1114
|
+
Source: https://orm.drizzle.team/docs/get-started/d1-new
|
|
1115
|
+
|
|
1116
|
+
Installs the necessary Drizzle ORM packages and development tools using pnpm. `drizzle-orm` and `dotenv` are for runtime, while `drizzle-kit` and `tsx` are for development.
|
|
1117
|
+
|
|
1118
|
+
```bash
|
|
1119
|
+
pnpm add drizzle-orm dotenv
|
|
1120
|
+
pnpm add -D drizzle-kit tsx
|
|
1121
|
+
```
|
|
1122
|
+
|
|
1123
|
+
--------------------------------
|
|
1124
|
+
|
|
1125
|
+
### Install Drizzle ORM and Neon Serverless Driver (yarn)
|
|
1126
|
+
|
|
1127
|
+
Source: https://orm.drizzle.team/docs/connect-neon
|
|
1128
|
+
|
|
1129
|
+
Installs the Drizzle ORM and the Neon serverless driver using yarn. Also installs drizzle-kit as a development dependency.
|
|
1130
|
+
|
|
1131
|
+
```bash
|
|
1132
|
+
yarn add drizzle-orm @neondatabase/serverless
|
|
1133
|
+
yarn add -D drizzle-kit
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
--------------------------------
|
|
1137
|
+
|
|
1138
|
+
### Install Drizzle ORM and SQLite Packages (npm)
|
|
1139
|
+
|
|
1140
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-new
|
|
1141
|
+
|
|
1142
|
+
Installs the necessary Drizzle ORM, libsql client, dotenv, and development packages using npm. This command is for setting up a new project or adding dependencies to an existing one.
|
|
1143
|
+
|
|
1144
|
+
```bash
|
|
1145
|
+
npm i drizzle-orm @libsql/client dotenv
|
|
1146
|
+
npm i -D drizzle-kit tsx
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
--------------------------------
|
|
1150
|
+
|
|
1151
|
+
### Install Drizzle ORM and libSQL Client Packages
|
|
1152
|
+
|
|
1153
|
+
Source: https://orm.drizzle.team/docs/connect-turso
|
|
1154
|
+
|
|
1155
|
+
Installs the necessary Drizzle ORM and libSQL client packages for different package managers. This is the first step to connect Drizzle to Turso Cloud.
|
|
1156
|
+
|
|
1157
|
+
```npm
|
|
1158
|
+
npm i drizzle-orm @libsql/client
|
|
1159
|
+
npm i -D drizzle-kit
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
```yarn
|
|
1163
|
+
yarn add drizzle-orm @libsql/client
|
|
1164
|
+
yarn add -D drizzle-kit
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
```pnpm
|
|
1168
|
+
pnpm add drizzle-orm @libsql/client
|
|
1169
|
+
pnpm add -D drizzle-kit
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
```bun
|
|
1173
|
+
bun add drizzle-orm @libsql/client
|
|
1174
|
+
bun add -D drizzle-kit
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
--------------------------------
|
|
1178
|
+
|
|
1179
|
+
### Initialize Drizzle ORM Connection (Sync)
|
|
1180
|
+
|
|
1181
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
1182
|
+
|
|
1183
|
+
Initializes a synchronous Drizzle ORM connection by explicitly creating a postgres client and passing it to the Drizzle instance.
|
|
1184
|
+
|
|
1185
|
+
```typescript
|
|
1186
|
+
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
1187
|
+
import postgres from 'postgres'
|
|
1188
|
+
|
|
1189
|
+
async function main() {
|
|
1190
|
+
const client = postgres(process.env.DATABASE_URL)
|
|
1191
|
+
const db = drizzle({ client });
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
main();
|
|
1195
|
+
```
|
|
1196
|
+
|
|
1197
|
+
--------------------------------
|
|
1198
|
+
|
|
1199
|
+
### Install Drizzle ORM and Dependencies (npm)
|
|
1200
|
+
|
|
1201
|
+
Source: https://orm.drizzle.team/docs/get-started/d1-new
|
|
1202
|
+
|
|
1203
|
+
Installs the necessary Drizzle ORM packages and development tools using npm. `drizzle-orm` and `dotenv` are for runtime, while `drizzle-kit` and `tsx` are for development.
|
|
1204
|
+
|
|
1205
|
+
```bash
|
|
1206
|
+
npm i drizzle-orm dotenv
|
|
1207
|
+
npm i -D drizzle-kit tsx
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
--------------------------------
|
|
1211
|
+
|
|
1212
|
+
### Initialize Drizzle with SingleStore (Basic)
|
|
1213
|
+
|
|
1214
|
+
Source: https://orm.drizzle.team/docs/get-started/singlestore-new
|
|
1215
|
+
|
|
1216
|
+
Initializes Drizzle ORM with a SingleStore database connection using the DATABASE_URL from environment variables.
|
|
1217
|
+
|
|
1218
|
+
```typescript
|
|
1219
|
+
import 'dotenv/config';
|
|
1220
|
+
import { drizzle } from "drizzle-orm/singlestore";
|
|
1221
|
+
|
|
1222
|
+
const db = drizzle(process.env.DATABASE_URL);
|
|
1223
|
+
```
|
|
1224
|
+
|
|
1225
|
+
--------------------------------
|
|
1226
|
+
|
|
1227
|
+
### Environment Variable Setup
|
|
1228
|
+
|
|
1229
|
+
Source: https://orm.drizzle.team/docs/get-started/vercel-new
|
|
1230
|
+
|
|
1231
|
+
Defines the database connection URL in a `.env` file. For Vercel Postgres, it's crucial to name the variable `POSTGRES_URL`. The value can be obtained from the Vercel Postgres storage tab.
|
|
1232
|
+
|
|
1233
|
+
```dotenv
|
|
1234
|
+
POSTGRES_URL=
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
--------------------------------
|
|
1238
|
+
|
|
1239
|
+
### Database Connection URL in .env
|
|
1240
|
+
|
|
1241
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sql-new
|
|
1242
|
+
|
|
1243
|
+
Specifies the database connection string in the .env file, which Drizzle ORM will use to connect to the database.
|
|
1244
|
+
|
|
1245
|
+
```dotenv
|
|
1246
|
+
DATABASE_URL=
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
--------------------------------
|
|
1250
|
+
|
|
1251
|
+
### Install Drizzle ORM and Dependencies (yarn)
|
|
1252
|
+
|
|
1253
|
+
Source: https://orm.drizzle.team/docs/get-started/d1-new
|
|
1254
|
+
|
|
1255
|
+
Installs the necessary Drizzle ORM packages and development tools using yarn. `drizzle-orm` and `dotenv` are for runtime, while `drizzle-kit` and `tsx` are for development.
|
|
1256
|
+
|
|
1257
|
+
```bash
|
|
1258
|
+
yarn add drizzle-orm dotenv
|
|
1259
|
+
yarn add -D drizzle-kit tsx
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
--------------------------------
|
|
1263
|
+
|
|
1264
|
+
### Install Drizzle ORM and Neon Packages (yarn)
|
|
1265
|
+
|
|
1266
|
+
Source: https://orm.drizzle.team/docs/get-started/neon-new
|
|
1267
|
+
|
|
1268
|
+
Installs the core Drizzle ORM package, the Neon serverless driver, dotenv for environment variables, and development tools like Drizzle Kit and tsx using yarn.
|
|
1269
|
+
|
|
1270
|
+
```bash
|
|
1271
|
+
yarn add drizzle-orm @neondatabase/serverless dotenv
|
|
1272
|
+
yarn add -D drizzle-kit tsx
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
--------------------------------
|
|
1276
|
+
|
|
1277
|
+
### Start PostgreSQL Docker Container
|
|
1278
|
+
|
|
1279
|
+
Source: https://orm.drizzle.team/docs/guides/postgresql-local-setup
|
|
1280
|
+
|
|
1281
|
+
This command starts a new PostgreSQL container named 'drizzle-postgres'. It sets the password, runs in detached mode, and maps port 5432 from the container to the host.
|
|
1282
|
+
|
|
1283
|
+
```bash
|
|
1284
|
+
docker run --name drizzle-postgres -e POSTGRES_PASSWORD=mypassword -d -p 5432:5432 postgres
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
--------------------------------
|
|
1288
|
+
|
|
1289
|
+
### Run TypeScript Files using tsx Command
|
|
1290
|
+
|
|
1291
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
1292
|
+
|
|
1293
|
+
This section provides commands to execute TypeScript files using the 'tsx' tool across different package managers (npm, yarn, pnpm, bun). It's a convenient way to run scripts without a full TypeScript compilation step. Ensure 'tsx' is installed in your project.
|
|
1294
|
+
|
|
1295
|
+
```bash
|
|
1296
|
+
npx tsx src/index.ts
|
|
1297
|
+
```
|
|
1298
|
+
|
|
1299
|
+
```bash
|
|
1300
|
+
yarn tsx src/index.ts
|
|
1301
|
+
```
|
|
1302
|
+
|
|
1303
|
+
```bash
|
|
1304
|
+
pnpm tsx src/index.ts
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
```bash
|
|
1308
|
+
bunx tsx src/index.ts
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
--------------------------------
|
|
1312
|
+
|
|
1313
|
+
### Install Drizzle ORM and AWS SDK for PostgreSQL (bun)
|
|
1314
|
+
|
|
1315
|
+
Source: https://orm.drizzle.team/docs/connect-aws-data-api-pg
|
|
1316
|
+
|
|
1317
|
+
Installs the Drizzle ORM package and the AWS SDK client for RDS Data using bun. Also installs drizzle-kit as a development dependency for schema management.
|
|
1318
|
+
|
|
1319
|
+
```bash
|
|
1320
|
+
bun add drizzle-orm @aws-sdk/client-rds-data
|
|
1321
|
+
bun add -D drizzle-kit
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
--------------------------------
|
|
1325
|
+
|
|
1326
|
+
### Initialize Drizzle ORM with Existing PlanetScale Client
|
|
1327
|
+
|
|
1328
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
1329
|
+
|
|
1330
|
+
Initializes the Drizzle ORM instance by providing an existing PlanetScale client instance. This allows for more control over the client configuration.
|
|
1331
|
+
|
|
1332
|
+
```typescript
|
|
1333
|
+
import { drizzle } from "drizzle-orm/planetscale-serverless";
|
|
1334
|
+
import { Client } from "@planetscale/database";
|
|
1335
|
+
|
|
1336
|
+
const client = new Client({
|
|
1337
|
+
host: process.env.DATABASE_HOST!,
|
|
1338
|
+
username: process.env.DATABASE_USERNAME!,
|
|
1339
|
+
password: process.env.DATABASE_PASSWORD!,
|
|
1340
|
+
});
|
|
1341
|
+
|
|
1342
|
+
const db = drizzle({ client: client });
|
|
1343
|
+
```
|
|
1344
|
+
|
|
1345
|
+
--------------------------------
|
|
1346
|
+
|
|
1347
|
+
### Configure Drizzle Kit for SQLite
|
|
1348
|
+
|
|
1349
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sqlite-new
|
|
1350
|
+
|
|
1351
|
+
Sets up the drizzle.config.ts file for Drizzle Kit. Specifies the output directory for migrations, schema file location, dialect (sqlite), and database credentials.
|
|
1352
|
+
|
|
1353
|
+
```typescript
|
|
1354
|
+
import 'dotenv/config';
|
|
1355
|
+
import { defineConfig } from 'drizzle-kit';
|
|
1356
|
+
|
|
1357
|
+
export default defineConfig({
|
|
1358
|
+
out: './drizzle',
|
|
1359
|
+
schema: './src/db/schema.ts',
|
|
1360
|
+
dialect: 'sqlite',
|
|
1361
|
+
dbCredentials: {
|
|
1362
|
+
url: process.env.DB_FILE_NAME!,
|
|
1363
|
+
},
|
|
1364
|
+
});
|
|
1365
|
+
```
|
|
1366
|
+
|
|
1367
|
+
--------------------------------
|
|
1368
|
+
|
|
1369
|
+
### Install Drizzle ORM and SQLite Packages (yarn)
|
|
1370
|
+
|
|
1371
|
+
Source: https://orm.drizzle.team/docs/get-started/sqlite-new
|
|
1372
|
+
|
|
1373
|
+
Installs the necessary Drizzle ORM, libsql client, dotenv, and development packages using yarn. This command is for setting up a new project or adding dependencies to an existing one.
|
|
1374
|
+
|
|
1375
|
+
```bash
|
|
1376
|
+
yarn add drizzle-orm @libsql/client dotenv
|
|
1377
|
+
yarn add -D drizzle-kit tsx
|
|
1378
|
+
```
|
|
1379
|
+
|
|
1380
|
+
--------------------------------
|
|
1381
|
+
|
|
1382
|
+
### Install Drizzle ORM and Dependencies (pnpm)
|
|
1383
|
+
|
|
1384
|
+
Source: https://orm.drizzle.team/docs/get-started/turso-database-new
|
|
1385
|
+
|
|
1386
|
+
Installs the necessary Drizzle ORM packages and development tools using pnpm. This command adds the beta versions of `drizzle-orm` and `drizzle-kit`, along with `@tursodatabase/database`, `dotenv`, and `tsx` to the project's dependencies.
|
|
1387
|
+
|
|
1388
|
+
```bash
|
|
1389
|
+
pnpm add drizzle-orm@beta @tursodatabase/database dotenv
|
|
1390
|
+
pnpm add -D drizzle-kit@beta tsx
|
|
1391
|
+
```
|
|
1392
|
+
|
|
1393
|
+
--------------------------------
|
|
1394
|
+
|
|
1395
|
+
### Install Drizzle ORM and AWS SDK for PostgreSQL (npm)
|
|
1396
|
+
|
|
1397
|
+
Source: https://orm.drizzle.team/docs/connect-aws-data-api-pg
|
|
1398
|
+
|
|
1399
|
+
Installs the Drizzle ORM package and the AWS SDK client for RDS Data using npm. Also installs drizzle-kit as a development dependency for schema management.
|
|
1400
|
+
|
|
1401
|
+
```bash
|
|
1402
|
+
npm i drizzle-orm @aws-sdk/client-rds-data
|
|
1403
|
+
npm i -D drizzle-kit
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1406
|
+
--------------------------------
|
|
1407
|
+
|
|
1408
|
+
### Initialize Drizzle ORM with PlanetScale Serverless Driver
|
|
1409
|
+
|
|
1410
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
1411
|
+
|
|
1412
|
+
Initializes the Drizzle ORM instance using the PlanetScale serverless driver. It reads connection details from environment variables.
|
|
1413
|
+
|
|
1414
|
+
```typescript
|
|
1415
|
+
import { drizzle } from "drizzle-orm/planetscale-serverless";
|
|
1416
|
+
|
|
1417
|
+
const db = drizzle({ connection: {
|
|
1418
|
+
host: process.env.DATABASE_HOST!,
|
|
1419
|
+
username: process.env.DATABASE_USERNAME!,
|
|
1420
|
+
password: process.env.DATABASE_PASSWORD!,
|
|
1421
|
+
}});
|
|
1422
|
+
```
|
|
1423
|
+
|
|
1424
|
+
--------------------------------
|
|
1425
|
+
|
|
1426
|
+
### Running the Application
|
|
1427
|
+
|
|
1428
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-nile
|
|
1429
|
+
|
|
1430
|
+
This command starts the Node.js web application using `tsx`, allowing you to test the implemented API endpoints.
|
|
1431
|
+
|
|
1432
|
+
```bash
|
|
1433
|
+
npx tsx src/app.ts
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
--------------------------------
|
|
1437
|
+
|
|
1438
|
+
### Install Drizzle ORM and PostgreSQL Dependencies (bun)
|
|
1439
|
+
|
|
1440
|
+
Source: https://orm.drizzle.team/docs/get-started/nile-new
|
|
1441
|
+
|
|
1442
|
+
Installs the core Drizzle ORM package, the 'pg' driver for PostgreSQL, 'dotenv' for environment variables, and development dependencies like 'drizzle-kit', 'tsx', and '@types/pg' using bun.
|
|
1443
|
+
|
|
1444
|
+
```bash
|
|
1445
|
+
bun add drizzle-orm pg dotenv
|
|
1446
|
+
bun add -D drizzle-kit tsx @types/pg
|
|
1447
|
+
```
|
|
1448
|
+
|
|
1449
|
+
--------------------------------
|
|
1450
|
+
|
|
1451
|
+
### Push Migrations with Multiple Config Files (bun)
|
|
1452
|
+
|
|
1453
|
+
Source: https://orm.drizzle.team/docs/drizzle-kit-push
|
|
1454
|
+
|
|
1455
|
+
Provides examples of pushing database migrations using multiple Drizzle Kit configuration files with bun.
|
|
1456
|
+
|
|
1457
|
+
```bash
|
|
1458
|
+
bunx drizzle-kit push --config=drizzle-dev.config.ts
|
|
1459
|
+
bunx drizzle-kit push --config=drizzle-prod.config.ts
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
--------------------------------
|
|
1463
|
+
|
|
1464
|
+
### PlanetScale Database Connection Variables
|
|
1465
|
+
|
|
1466
|
+
Source: https://orm.drizzle.team/docs/get-started/planetscale-new
|
|
1467
|
+
|
|
1468
|
+
Defines the environment variables required to connect to the PlanetScale database. These include the host, username, and password.
|
|
1469
|
+
|
|
1470
|
+
```env
|
|
1471
|
+
DATABASE_HOST=
|
|
1472
|
+
DATABASE_USERNAME=
|
|
1473
|
+
DATABASE_PASSWORD=
|
|
1474
|
+
```
|
|
1475
|
+
|
|
1476
|
+
--------------------------------
|
|
1477
|
+
|
|
1478
|
+
### Drizzle ORM Configuration Example (TypeScript)
|
|
1479
|
+
|
|
1480
|
+
Source: https://orm.drizzle.team/docs/drizzle-kit-migrate
|
|
1481
|
+
|
|
1482
|
+
Provides an example TypeScript configuration file for Drizzle ORM. It specifies the database dialect, schema location, credentials, and migration table/schema settings. This file is essential for defining your database connection and migration strategy.
|
|
1483
|
+
|
|
1484
|
+
```typescript
|
|
1485
|
+
import { defineConfig } from "drizzle-kit";
|
|
1486
|
+
|
|
1487
|
+
export default defineConfig({
|
|
1488
|
+
dialect: "postgresql",
|
|
1489
|
+
schema: "./src/schema.ts",
|
|
1490
|
+
dbCredentials: {
|
|
1491
|
+
url: "postgresql://user:password@host:port/dbname"
|
|
1492
|
+
},
|
|
1493
|
+
migrations: {
|
|
1494
|
+
table: 'journal',
|
|
1495
|
+
schema: 'drizzle',
|
|
1496
|
+
},
|
|
1497
|
+
});
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
--------------------------------
|
|
1501
|
+
|
|
1502
|
+
### Install Drizzle ORM and Dependencies (yarn)
|
|
1503
|
+
|
|
1504
|
+
Source: https://orm.drizzle.team/docs/get-started/turso-database-new
|
|
1505
|
+
|
|
1506
|
+
Installs the required Drizzle ORM packages and development tools using yarn. This command ensures that the beta versions of `drizzle-orm` and `drizzle-kit`, along with `@tursodatabase/database`, `dotenv`, and `tsx`, are included in the project dependencies.
|
|
1507
|
+
|
|
1508
|
+
```bash
|
|
1509
|
+
yarn add drizzle-orm@beta @tursodatabase/database dotenv
|
|
1510
|
+
yarn add -D drizzle-kit@beta tsx
|
|
1511
|
+
```
|
|
1512
|
+
|
|
1513
|
+
--------------------------------
|
|
1514
|
+
|
|
1515
|
+
### Example SQL Migration File for Drizzle ORM
|
|
1516
|
+
|
|
1517
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-neon
|
|
1518
|
+
|
|
1519
|
+
Illustrates the structure of a SQL migration file generated by Drizzle Kit. This example shows the creation of two tables, 'posts_table' and 'users_table', including primary keys, constraints, and foreign key relationships.
|
|
1520
|
+
|
|
1521
|
+
```sql
|
|
1522
|
+
CREATE TABLE IF NOT EXISTS "posts_table" (
|
|
1523
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
1524
|
+
"title" text NOT NULL,
|
|
1525
|
+
"content" text NOT NULL,
|
|
1526
|
+
"user_id" integer NOT NULL,
|
|
1527
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
1528
|
+
"updated_at" timestamp NOT NULL
|
|
1529
|
+
);
|
|
1530
|
+
--> statement-breakpoint
|
|
1531
|
+
CREATE TABLE IF NOT EXISTS "users_table" (
|
|
1532
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
1533
|
+
"name" text NOT NULL,
|
|
1534
|
+
"age" integer NOT NULL,
|
|
1535
|
+
"email" text NOT NULL,
|
|
1536
|
+
CONSTRAINT "users_table_email_unique" UNIQUE("email")
|
|
1537
|
+
);
|
|
1538
|
+
--> statement-breakpoint
|
|
1539
|
+
DO $$ BEGIN
|
|
1540
|
+
ALTER TABLE "posts_table" ADD CONSTRAINT "posts_table_user_id_users_table_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users_table"("id") ON DELETE cascade ON UPDATE no action;
|
|
1541
|
+
EXCEPTION
|
|
1542
|
+
WHEN duplicate_object THEN null;
|
|
1543
|
+
END $$;
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
--------------------------------
|
|
1547
|
+
|
|
1548
|
+
### Install postgres package (bun)
|
|
1549
|
+
|
|
1550
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-supabase
|
|
1551
|
+
|
|
1552
|
+
Installs the postgres package using bun, a Node.js driver for PostgreSQL that Drizzle ORM can use.
|
|
1553
|
+
|
|
1554
|
+
```bash
|
|
1555
|
+
bun add postgres
|
|
1556
|
+
```
|
|
1557
|
+
|
|
1558
|
+
--------------------------------
|
|
1559
|
+
|
|
1560
|
+
### Install @libsql/client Package
|
|
1561
|
+
|
|
1562
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-turso
|
|
1563
|
+
|
|
1564
|
+
Installs the '@libsql/client' package, which is the official driver for interacting with libSQL-compatible databases like Turso. This client enables Drizzle ORM to communicate with the database.
|
|
1565
|
+
|
|
1566
|
+
```npm
|
|
1567
|
+
npm i @libsql/client
|
|
1568
|
+
```
|
|
1569
|
+
|
|
1570
|
+
```yarn
|
|
1571
|
+
yarn add @libsql/client
|
|
1572
|
+
```
|
|
1573
|
+
|
|
1574
|
+
```pnpm
|
|
1575
|
+
pnpm add @libsql/client
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
```bun
|
|
1579
|
+
bun add @libsql/client
|
|
1580
|
+
```
|
|
1581
|
+
|
|
1582
|
+
--------------------------------
|
|
1583
|
+
|
|
1584
|
+
### Initialize Drizzle Connection with Existing Driver
|
|
1585
|
+
|
|
1586
|
+
Source: https://orm.drizzle.team/docs/get-started/turso-database-new
|
|
1587
|
+
|
|
1588
|
+
Demonstrates how to initialize Drizzle ORM when you already have an existing database client instance. This is useful for integrating Drizzle with pre-configured database connections or custom driver setups.
|
|
1589
|
+
|
|
1590
|
+
```typescript
|
|
1591
|
+
import 'dotenv/config';
|
|
1592
|
+
import { Database } from '@tursodatabase/database';
|
|
1593
|
+
import { drizzle } from 'drizzle-orm/tursodatabase/database';
|
|
1594
|
+
|
|
1595
|
+
const client = new Database(process.env.DB_FILE_NAME!);
|
|
1596
|
+
const db = drizzle({ client });
|
|
1597
|
+
```
|
|
1598
|
+
|
|
1599
|
+
--------------------------------
|
|
1600
|
+
|
|
1601
|
+
### Install Drizzle and Gel Packages (bun)
|
|
1602
|
+
|
|
1603
|
+
Source: https://orm.drizzle.team/docs/get-started-gel
|
|
1604
|
+
|
|
1605
|
+
Installs the necessary Drizzle ORM and Gel packages for bun projects. Includes the development dependency for Drizzle Kit.
|
|
1606
|
+
|
|
1607
|
+
```bash
|
|
1608
|
+
bun add drizzle-orm gel
|
|
1609
|
+
bun add -D drizzle-kit
|
|
1610
|
+
```
|
|
1611
|
+
|
|
1612
|
+
--------------------------------
|
|
1613
|
+
|
|
1614
|
+
### Install Drizzle ORM and PostgreSQL Dependencies (npm)
|
|
1615
|
+
|
|
1616
|
+
Source: https://orm.drizzle.team/docs/get-started/nile-new
|
|
1617
|
+
|
|
1618
|
+
Installs the core Drizzle ORM package, the 'pg' driver for PostgreSQL, 'dotenv' for environment variables, and development dependencies like 'drizzle-kit', 'tsx', and '@types/pg'.
|
|
1619
|
+
|
|
1620
|
+
```bash
|
|
1621
|
+
npm i drizzle-orm pg dotenv
|
|
1622
|
+
npm i -D drizzle-kit tsx @types/pg
|
|
1623
|
+
```
|
|
1624
|
+
|
|
1625
|
+
--------------------------------
|
|
1626
|
+
|
|
1627
|
+
### Drizzle Kit Generate Migration Process
|
|
1628
|
+
|
|
1629
|
+
Source: https://orm.drizzle.team/docs/drizzle-kit-generate
|
|
1630
|
+
|
|
1631
|
+
Visual representation of the `drizzle-kit generate` process, outlining steps from reading migration folders to generating SQL files.
|
|
1632
|
+
|
|
1633
|
+
```ascii-art
|
|
1634
|
+
┌────────────────────────┐
|
|
1635
|
+
│ $ drizzle-kit generate │
|
|
1636
|
+
└─┬──────────────────────┘
|
|
1637
|
+
│
|
|
1638
|
+
└ 1. read previous migration folders
|
|
1639
|
+
2. find diff between current and previous scheama
|
|
1640
|
+
3. prompt developer for renames if necessary
|
|
1641
|
+
┌ 4. generate SQL migration and persist to file
|
|
1642
|
+
│ ┌─┴───────────────────────────────────────┐
|
|
1643
|
+
│ 📂 drizzle
|
|
1644
|
+
│ ├ 📂 _meta
|
|
1645
|
+
│ └ 📜 0000_premium_mister_fear.sql
|
|
1646
|
+
v
|
|
1647
|
+
```
|
|
1648
|
+
|
|
1649
|
+
--------------------------------
|
|
1650
|
+
|
|
1651
|
+
### Install Drizzle ORM and mysql2 driver
|
|
1652
|
+
|
|
1653
|
+
Source: https://orm.drizzle.team/docs/get-started-singlestore
|
|
1654
|
+
|
|
1655
|
+
Installs the necessary Drizzle ORM packages and the `mysql2` driver for SingleStore integration using npm, yarn, pnpm, or bun.
|
|
1656
|
+
|
|
1657
|
+
```npm
|
|
1658
|
+
npm i drizzle-orm mysql2
|
|
1659
|
+
npm i -D drizzle-kit
|
|
1660
|
+
```
|
|
1661
|
+
|
|
1662
|
+
```yarn
|
|
1663
|
+
yarn add drizzle-orm mysql2
|
|
1664
|
+
yarn add -D drizzle-kit
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
```pnpm
|
|
1668
|
+
pnpm add drizzle-orm mysql2
|
|
1669
|
+
pnpm add -D drizzle-kit
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
```bun
|
|
1673
|
+
bun add drizzle-orm mysql2
|
|
1674
|
+
bun add -D drizzle-kit
|
|
1675
|
+
```
|
|
1676
|
+
|
|
1677
|
+
--------------------------------
|
|
1678
|
+
|
|
1679
|
+
### Start MySQL Docker Container
|
|
1680
|
+
|
|
1681
|
+
Source: https://orm.drizzle.team/docs/guides/mysql-local-setup
|
|
1682
|
+
|
|
1683
|
+
This command starts a MySQL container named 'drizzle-mysql' in detached mode. It sets the root password, maps port 3306 on the host to the container's port 3306 for external access, and uses the 'mysql' image. Optional environment variables can create databases and users upon container creation.
|
|
1684
|
+
|
|
1685
|
+
```bash
|
|
1686
|
+
docker run --name drizzle-mysql -e MYSQL_ROOT_PASSWORD=mypassword -d -p 3306:3306 mysql
|
|
1687
|
+
```
|
|
1688
|
+
|
|
1689
|
+
```bash
|
|
1690
|
+
docker ps
|
|
1691
|
+
```
|
|
1692
|
+
|
|
1693
|
+
--------------------------------
|
|
1694
|
+
|
|
1695
|
+
### Initialize Supabase Project
|
|
1696
|
+
|
|
1697
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-supabase-edge-functions
|
|
1698
|
+
|
|
1699
|
+
Initializes a new Supabase project locally. This command creates a 'supabase' folder containing configuration files for your Supabase project.
|
|
1700
|
+
|
|
1701
|
+
```bash
|
|
1702
|
+
supabase init
|
|
1703
|
+
```
|
|
1704
|
+
|
|
1705
|
+
--------------------------------
|
|
1706
|
+
|
|
1707
|
+
### Install Drizzle ORM and PostgreSQL Dependencies (pnpm)
|
|
1708
|
+
|
|
1709
|
+
Source: https://orm.drizzle.team/docs/get-started/nile-new
|
|
1710
|
+
|
|
1711
|
+
Installs the core Drizzle ORM package, the 'pg' driver for PostgreSQL, 'dotenv' for environment variables, and development dependencies like 'drizzle-kit', 'tsx', and '@types/pg' using pnpm.
|
|
1712
|
+
|
|
1713
|
+
```bash
|
|
1714
|
+
pnpm add drizzle-orm pg dotenv
|
|
1715
|
+
pnpm add -D drizzle-kit tsx @types/pg
|
|
1716
|
+
```
|
|
1717
|
+
|
|
1718
|
+
--------------------------------
|
|
1719
|
+
|
|
1720
|
+
### Set up Bun:SQLite Database Connection Variable
|
|
1721
|
+
|
|
1722
|
+
Source: https://orm.drizzle.team/docs/get-started/bun-sqlite-new
|
|
1723
|
+
|
|
1724
|
+
Defines the database file name for Bun:SQLite in the .env file. This variable is used to configure the database connection string for Drizzle ORM.
|
|
1725
|
+
|
|
1726
|
+
```env
|
|
1727
|
+
DB_FILE_NAME=mydb.sqlite
|
|
1728
|
+
```
|
|
1729
|
+
|
|
1730
|
+
--------------------------------
|
|
1731
|
+
|
|
1732
|
+
### Install Neon Serverless Driver
|
|
1733
|
+
|
|
1734
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-neon
|
|
1735
|
+
|
|
1736
|
+
Installs the Neon serverless driver, which is required for connecting Drizzle ORM to a Neon Postgres database. Supports multiple package managers.
|
|
1737
|
+
|
|
1738
|
+
```npm
|
|
1739
|
+
npm i @neondatabase/serverless
|
|
1740
|
+
```
|
|
1741
|
+
|
|
1742
|
+
```yarn
|
|
1743
|
+
yarn add @neondatabase/serverless
|
|
1744
|
+
```
|
|
1745
|
+
|
|
1746
|
+
```pnpm
|
|
1747
|
+
pnpm add @neondatabase/serverless
|
|
1748
|
+
```
|
|
1749
|
+
|
|
1750
|
+
```bun
|
|
1751
|
+
bun add @neondatabase/serverless
|
|
1752
|
+
```
|
|
1753
|
+
|
|
1754
|
+
--------------------------------
|
|
1755
|
+
|
|
1756
|
+
### Install Express Package
|
|
1757
|
+
|
|
1758
|
+
Source: https://orm.drizzle.team/docs/tutorials/drizzle-with-nile
|
|
1759
|
+
|
|
1760
|
+
Installs the 'express' package, a minimal and flexible Node.js web application framework, using common package managers.
|
|
1761
|
+
|
|
1762
|
+
```npm
|
|
1763
|
+
npm i express
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
```yarn
|
|
1767
|
+
yarn add express
|
|
1768
|
+
```
|
|
1769
|
+
|
|
1770
|
+
```pnpm
|
|
1771
|
+
pnpm add express
|
|
1772
|
+
```
|
|
1773
|
+
|
|
1774
|
+
```bun
|
|
1775
|
+
bun add express
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
--------------------------------
|
|
1779
|
+
|
|
1780
|
+
### Drizzle Configuration File
|
|
1781
|
+
|
|
1782
|
+
Source: https://orm.drizzle.team/docs/get-started/vercel-new
|
|
1783
|
+
|
|
1784
|
+
Sets up the `drizzle.config.ts` file, which Drizzle Kit uses for database operations. It specifies the migration output directory (`out`), schema file location (`schema`), database dialect (`dialect`), and credentials (including the `POSTGRES_URL` from environment variables).
|
|
1785
|
+
|
|
1786
|
+
```typescript
|
|
1787
|
+
import 'dotenv/config';
|
|
1788
|
+
import { defineConfig } from 'drizzle-kit';
|
|
1789
|
+
|
|
1790
|
+
export default defineConfig({
|
|
1791
|
+
out: './drizzle',
|
|
1792
|
+
schema: './src/db/schema.ts',
|
|
1793
|
+
dialect: 'postgresql',
|
|
1794
|
+
dbCredentials: {
|
|
1795
|
+
url: process.env.POSTGRES_URL!,
|
|
1796
|
+
},
|
|
1797
|
+
});
|
|
1798
|
+
```
|
|
1799
|
+
|
|
1800
|
+
--------------------------------
|
|
1801
|
+
|
|
1802
|
+
### Initialize Drizzle ORM Database Connection in TypeScript
|
|
1803
|
+
|
|
1804
|
+
Source: https://orm.drizzle.team/docs/get-started/gel-new
|
|
1805
|
+
|
|
1806
|
+
This snippet demonstrates how to initialize a connection to your database using Drizzle ORM and a 'gel' client. It requires the 'drizzle-orm/gel' and 'gel' packages. The output is a configured Drizzle database instance.
|
|
1807
|
+
|
|
1808
|
+
```typescript
|
|
1809
|
+
import { drizzle } from "drizzle-orm/gel";
|
|
1810
|
+
import { createClient } from "gel";
|
|
1811
|
+
|
|
1812
|
+
const gelClient = createClient();
|
|
1813
|
+
const db = drizzle({ client: gelClient });
|
|
1814
|
+
```
|
|
1815
|
+
|
|
1816
|
+
--------------------------------
|
|
1817
|
+
|
|
1818
|
+
### Install Drizzle ORM and Drizzle Kit with bun
|
|
1819
|
+
|
|
1820
|
+
Source: https://orm.drizzle.team/docs/connect-bun-sqlite
|
|
1821
|
+
|
|
1822
|
+
Installs Drizzle ORM and Drizzle Kit using the Bun runtime. Bun provides a fast alternative for package installation and JavaScript execution.
|
|
1823
|
+
|
|
1824
|
+
```bash
|
|
1825
|
+
bun add drizzle-orm
|
|
1826
|
+
bun add -D drizzle-kit
|
|
1827
|
+
```
|
|
1828
|
+
|
|
1829
|
+
--------------------------------
|
|
1830
|
+
|
|
1831
|
+
### Initialize SingleStore driver with connection options
|
|
1832
|
+
|
|
1833
|
+
Source: https://orm.drizzle.team/docs/get-started-singlestore
|
|
1834
|
+
|
|
1835
|
+
Initializes the Drizzle ORM driver for SingleStore by providing connection options, including the database URI, and shows a sample query.
|
|
1836
|
+
|
|
1837
|
+
```typescript
|
|
1838
|
+
import { drizzle } from "drizzle-orm/singlestore";
|
|
1839
|
+
|
|
1840
|
+
// You can specify any property from the mysql2 connection options
|
|
1841
|
+
const db = drizzle({ connection:{ uri: process.env.DATABASE_URL }});
|
|
1842
|
+
|
|
1843
|
+
const response = await db.select().from(...)
|
|
1844
|
+
```
|
|
1845
|
+
|
|
1846
|
+
--------------------------------
|
|
1847
|
+
|
|
1848
|
+
### Initialize Drizzle ORM Connection (Supabase Pool Mode)
|
|
1849
|
+
|
|
1850
|
+
Source: https://orm.drizzle.team/docs/get-started/supabase-new
|
|
1851
|
+
|
|
1852
|
+
Initializes a Drizzle ORM connection for Supabase with 'Transaction' pool mode enabled, disabling 'prepare' as it's not supported in this configuration.
|
|
1853
|
+
|
|
1854
|
+
```typescript
|
|
1855
|
+
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
1856
|
+
import postgres from 'postgres'
|
|
1857
|
+
|
|
1858
|
+
async function main() {
|
|
1859
|
+
// Disable prefetch as it is not supported for "Transaction" pool mode
|
|
1860
|
+
const client = postgres(process.env.DATABASE_URL, { prepare: false })
|
|
1861
|
+
const db = drizzle({ client });
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
main();
|
|
1865
|
+
```
|
|
1866
|
+
|
|
1867
|
+
--------------------------------
|
|
1868
|
+
|
|
1869
|
+
### Pull PostgreSQL Docker Image
|
|
1870
|
+
|
|
1871
|
+
Source: https://orm.drizzle.team/docs/guides/postgresql-local-setup
|
|
1872
|
+
|
|
1873
|
+
This command fetches the latest PostgreSQL Docker image from Docker Hub. You can also specify a particular version using tags, for example, `postgres:15`.
|
|
1874
|
+
|
|
1875
|
+
```bash
|
|
1876
|
+
docker pull postgres
|
|
1877
|
+
```
|
|
1878
|
+
|
|
1879
|
+
```bash
|
|
1880
|
+
docker pull postgres:15
|
|
1881
|
+
```
|
|
1882
|
+
|
|
1883
|
+
--------------------------------
|
|
1884
|
+
|
|
1885
|
+
### Install Drizzle ORM and PostgreSQL Dependencies (yarn)
|
|
1886
|
+
|
|
1887
|
+
Source: https://orm.drizzle.team/docs/get-started/nile-new
|
|
1888
|
+
|
|
1889
|
+
Installs the core Drizzle ORM package, the 'pg' driver for PostgreSQL, 'dotenv' for environment variables, and development dependencies like 'drizzle-kit', 'tsx', and '@types/pg' using yarn.
|
|
1890
|
+
|
|
1891
|
+
```bash
|
|
1892
|
+
yarn add drizzle-orm pg dotenv
|
|
1893
|
+
yarn add -D drizzle-kit tsx @types/pg
|
|
1894
|
+
```
|