├── supabase ├── seed.sql ├── .gitignore └── README.md ├── patches └── README.md ├── vscode-extension ├── .gitignore ├── icon.png ├── media │ ├── drizzle.png │ └── drizzle_dark.png ├── README.md ├── .vscodeignore ├── src │ ├── modules │ │ ├── visualizer │ │ │ ├── stop-visualizer │ │ │ │ └── command.ts │ │ │ ├── panel.ts │ │ │ └── open-visualizer │ │ │ │ └── codelens.ts │ │ └── studio │ │ │ ├── stop-studio │ │ │ └── command.ts │ │ │ ├── panel.ts │ │ │ └── open-studio │ │ │ └── codelens.ts │ └── views │ │ └── index.tsx ├── tsconfig.json └── LICENSE ├── apps ├── drizzle-run │ ├── app │ │ ├── registry │ │ │ ├── .gitignore │ │ │ ├── .prettierrc │ │ │ ├── README.md │ │ │ ├── dialects │ │ │ │ ├── sqlite │ │ │ │ │ ├── presets │ │ │ │ │ │ ├── _blank │ │ │ │ │ │ │ ├── manifest.json │ │ │ │ │ │ │ ├── db.ts │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ └── schema.ts │ │ │ │ │ │ └── starter-01 │ │ │ │ │ │ │ ├── manifest.json │ │ │ │ │ │ │ ├── db.ts │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ └── seed.ts │ │ │ │ │ └── core │ │ │ │ │ │ ├── utils.ts │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── schema.ts │ │ │ │ │ │ ├── seed.ts │ │ │ │ │ │ └── db.ts │ │ │ │ ├── postgresql │ │ │ │ │ ├── presets │ │ │ │ │ │ ├── _blank │ │ │ │ │ │ │ ├── manifest.json │ │ │ │ │ │ │ ├── db.ts │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ └── schema.ts │ │ │ │ │ │ ├── starter-01 │ │ │ │ │ │ │ ├── manifest.json │ │ │ │ │ │ │ ├── db.ts │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ ├── seed.ts │ │ │ │ │ │ │ └── schema.ts │ │ │ │ │ │ └── rls │ │ │ │ │ │ │ ├── manifest.json │ │ │ │ │ │ │ ├── db.ts │ │ │ │ │ │ │ └── seed.ts │ │ │ │ │ └── core │ │ │ │ │ │ ├── utils.ts │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── schema.ts │ │ │ │ │ │ ├── seed.ts │ │ │ │ │ │ └── db.ts │ │ │ │ └── manifest.schema.json │ │ │ ├── utils │ │ │ │ └── query-logger.ts │ │ │ ├── meta.schema.json │ │ │ └── presets.test.ts │ │ ├── utils │ │ │ ├── is-browser.ts │ │ │ ├── cn.ts │ │ │ ├── robot.ts │ │ │ ├── assert.ts │ │ │ ├── use-is-mobile-app-layout.ts │ │ │ ├── use-form.ts │ │ │ └── use-dialog.ts │ │ ├── routes │ │ │ ├── _.$.tsx │ │ │ ├── auth.sign-out │ │ │ │ └── route.tsx │ │ │ └── healthcheck.tsx │ │ ├── database │ │ │ ├── utils.ts │ │ │ ├── .client │ │ │ │ ├── migrations │ │ │ │ │ ├── meta │ │ │ │ │ │ └── _journal.json │ │ │ │ │ ├── 0000_init.sql │ │ │ │ │ └── export.json │ │ │ │ └── schema.ts │ │ │ ├── .server │ │ │ │ ├── migrations │ │ │ │ │ ├── meta │ │ │ │ │ │ └── _journal.json │ │ │ │ │ └── 0001_unknown_unicorn.sql │ │ │ │ ├── db.ts │ │ │ │ └── relations.ts │ │ │ ├── scripts │ │ │ │ └── export-local-db-migrations.ts │ │ │ └── types.ts │ │ ├── routes.ts │ │ ├── components │ │ │ ├── ui │ │ │ │ ├── icons │ │ │ │ │ └── README.md │ │ │ │ ├── skeleton.tsx │ │ │ │ ├── label.tsx │ │ │ │ ├── separator.tsx │ │ │ │ ├── textarea.tsx │ │ │ │ ├── input.tsx │ │ │ │ ├── sonner.tsx │ │ │ │ ├── checkbox.tsx │ │ │ │ ├── badge.tsx │ │ │ │ └── tooltip.tsx │ │ │ ├── toolbar.tsx │ │ │ ├── nav-item.tsx │ │ │ └── anonymous-cta.tsx │ │ ├── entry.client.tsx │ │ ├── modules │ │ │ └── playground │ │ │ │ └── highlighter.ts │ │ └── server │ │ │ ├── session.ts │ │ │ ├── index.ts │ │ │ └── middleware.ts │ ├── .drizzle-lab │ │ ├── client.json │ │ ├── visualizer.json │ │ └── server.json │ ├── public │ │ ├── favicon.ico │ │ └── fonts │ │ │ ├── Inter-Medium.ttf │ │ │ └── Inter-Regular.ttf │ ├── types │ │ ├── reset.d.ts │ │ ├── icon-name.d.ts │ │ ├── brand.d.ts │ │ └── global.d.ts │ ├── react-router.config.ts │ ├── other │ │ ├── svg-icons │ │ │ ├── x.svg │ │ │ ├── check.svg │ │ │ ├── chevron-right.svg │ │ │ ├── play.svg │ │ │ ├── cloud.svg │ │ │ ├── chevrons-up-down.svg │ │ │ ├── code.svg │ │ │ ├── user-round.svg │ │ │ ├── panel-top.svg │ │ │ ├── info.svg │ │ │ ├── captions.svg │ │ │ ├── lock.svg │ │ │ ├── ellipsis-vertical.svg │ │ │ ├── history.svg │ │ │ ├── arrow-right-left.svg │ │ │ ├── circle-user-round.svg │ │ │ ├── database.svg │ │ │ ├── square-terminal.svg │ │ │ ├── book-text.svg │ │ │ ├── diamond.svg │ │ │ ├── settings-2.svg │ │ │ ├── cloud-upload.svg │ │ │ ├── external-link.svg │ │ │ ├── camera.svg │ │ │ ├── share.svg │ │ │ ├── ghost.svg │ │ │ ├── log-out.svg │ │ │ ├── clipboard.svg │ │ │ ├── eye.svg │ │ │ ├── link.svg │ │ │ ├── triangle-alert.svg │ │ │ ├── eraser.svg │ │ │ ├── wrench.svg │ │ │ ├── file-pen-line.svg │ │ │ ├── braces.svg │ │ │ ├── shield.svg │ │ │ ├── shrink.svg │ │ │ ├── cloud-off.svg │ │ │ ├── clipboard-check.svg │ │ │ ├── folder-open.svg │ │ │ ├── box.svg │ │ │ ├── book-image.svg │ │ │ ├── git-fork.svg │ │ │ ├── list-restart.svg │ │ │ ├── badge-check.svg │ │ │ ├── save.svg │ │ │ ├── shield-check.svg │ │ │ ├── image-down.svg │ │ │ ├── captions-off.svg │ │ │ ├── share-2.svg │ │ │ ├── trash-2.svg │ │ │ ├── loader-pinwheel.svg │ │ │ ├── sheet.svg │ │ │ ├── key-round.svg │ │ │ ├── view.svg │ │ │ ├── box-plus.svg │ │ │ ├── sprout.svg │ │ │ ├── cable.svg │ │ │ ├── github.svg │ │ │ ├── wand-sparkles.svg │ │ │ ├── bug-off.svg │ │ │ ├── telescope.svg │ │ │ ├── bug-play.svg │ │ │ └── bug.svg │ │ └── sly.json │ ├── drizzle.client.config.ts │ ├── drizzle.server.config.ts │ ├── .env.example │ ├── fly.toml │ └── tsconfig.json └── cli │ ├── example │ ├── pg │ │ ├── external.ts │ │ └── drizzle.config.ts │ ├── multi-files-barrel │ │ ├── schemas │ │ │ ├── index.ts │ │ │ ├── users.ts │ │ │ └── relations.ts │ │ ├── enums.ts │ │ ├── index.ts │ │ └── drizzle.config.ts │ ├── multi-files │ │ ├── schemas │ │ │ ├── users.ts │ │ │ └── relations.ts │ │ └── drizzle.config.ts │ ├── multi-packages │ │ ├── package-users │ │ │ └── database │ │ │ │ └── schema.ts │ │ ├── drizzle.config.ts │ │ ├── drizzle.config.dev.ts │ │ └── package-relations │ │ │ └── database │ │ │ └── relations.ts │ ├── sqlite │ │ └── drizzle.config.ts │ └── mysql │ │ └── drizzle.config.ts │ ├── .gitignore │ ├── public │ ├── error.webp │ └── favicon.png │ ├── postcss.config.js │ ├── tsconfig.build.json │ ├── .eslintrc.cjs │ ├── tailwind.config.ts │ ├── visualizer │ └── entry.client.tsx │ ├── drizzle.config.ts │ ├── tsconfig.json │ └── LICENSE ├── .env.example ├── packages ├── api │ ├── src │ │ ├── extensions │ │ │ ├── index.ts │ │ │ └── symbols.ts │ │ ├── sql │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── relations │ │ │ └── index.ts │ │ ├── pg │ │ │ ├── index.node.ts │ │ │ ├── index.web.ts │ │ │ ├── utils.ts │ │ │ └── index.ts │ │ ├── sqlite │ │ │ ├── index.node.ts │ │ │ ├── index.web.ts │ │ │ ├── index.ts │ │ │ └── serializer │ │ │ │ └── sql-to-snapshot.ts │ │ ├── mysql │ │ │ ├── index.node.ts │ │ │ ├── index.web.ts │ │ │ └── index.ts │ │ ├── config │ │ │ ├── index.node.ts │ │ │ └── env.node.ts │ │ └── internal │ │ │ ├── relations.ts │ │ │ └── style.ts │ ├── tsconfig.json │ └── tsup.config.ts └── visualizer │ ├── vite-env.d.ts │ ├── src │ ├── index.ts │ ├── lib │ │ └── utils.ts │ └── components │ │ ├── theme.ts │ │ └── ui │ │ └── separator.tsx │ ├── demo │ ├── main.tsx │ └── app.tsx │ ├── .gitignore │ ├── components.json │ ├── index.html │ ├── tsconfig.json │ ├── vite.config.ts │ └── README.md ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── docs-template.yaml │ └── feature-template.yaml └── PULL_REQUEST_TEMPLATE.md ├── shared ├── eslint-config │ ├── README.md │ └── package.json ├── typescript-config │ ├── reset.d.ts │ ├── package.json │ ├── react-library.json │ ├── remix.json │ ├── base.json │ └── node-library.json ├── ui │ ├── types │ │ └── icon-name.d.ts │ ├── src │ │ ├── icons │ │ │ └── README.md │ │ ├── utils │ │ │ └── cn.ts │ │ └── components │ │ │ ├── skeleton.tsx │ │ │ ├── label.tsx │ │ │ ├── textarea.tsx │ │ │ ├── input.tsx │ │ │ ├── separator.tsx │ │ │ ├── sonner.tsx │ │ │ ├── checkbox.tsx │ │ │ └── switch.tsx │ ├── turbo.json │ ├── .eslintrc.cjs │ ├── other │ │ ├── sly.json │ │ └── svg-icons │ │ │ ├── check.svg │ │ │ ├── chevron-right.svg │ │ │ ├── play.svg │ │ │ ├── cloud.svg │ │ │ ├── chevrons-up-down.svg │ │ │ ├── user-round.svg │ │ │ ├── code.svg │ │ │ ├── panel-top.svg │ │ │ ├── info.svg │ │ │ ├── lock.svg │ │ │ ├── captions.svg │ │ │ ├── ellipsis-vertical.svg │ │ │ ├── arrow-right-left.svg │ │ │ ├── circle-user-round.svg │ │ │ ├── history.svg │ │ │ ├── database.svg │ │ │ ├── diamond.svg │ │ │ ├── settings-2.svg │ │ │ ├── square-terminal.svg │ │ │ ├── book-text.svg │ │ │ ├── cloud-upload.svg │ │ │ ├── external-link.svg │ │ │ ├── camera.svg │ │ │ ├── log-out.svg │ │ │ ├── share.svg │ │ │ ├── clipboard.svg │ │ │ ├── eye.svg │ │ │ ├── ghost.svg │ │ │ ├── link.svg │ │ │ ├── triangle-alert.svg │ │ │ ├── eraser.svg │ │ │ ├── file-pen-line.svg │ │ │ ├── wrench.svg │ │ │ ├── braces.svg │ │ │ ├── shield.svg │ │ │ ├── shrink.svg │ │ │ ├── clipboard-check.svg │ │ │ ├── cloud-off.svg │ │ │ ├── box.svg │ │ │ ├── folder-open.svg │ │ │ ├── book-image.svg │ │ │ ├── git-fork.svg │ │ │ ├── badge-check.svg │ │ │ ├── list-restart.svg │ │ │ ├── image-down.svg │ │ │ ├── save.svg │ │ │ ├── shield-check.svg │ │ │ ├── captions-off.svg │ │ │ ├── share-2.svg │ │ │ ├── trash-2.svg │ │ │ ├── loader-pinwheel.svg │ │ │ ├── sheet.svg │ │ │ ├── key-round.svg │ │ │ ├── view.svg │ │ │ ├── box-plus.svg │ │ │ ├── sprout.svg │ │ │ ├── cable.svg │ │ │ ├── github.svg │ │ │ ├── wand-sparkles.svg │ │ │ ├── bug-off.svg │ │ │ ├── telescope.svg │ │ │ ├── bug-play.svg │ │ │ └── bug.svg │ ├── tsconfig.json │ └── components.json └── eslint-plugin-node-imports │ └── package.json ├── .gitignore ├── .vscode ├── extensions.json ├── settings.json └── launch.json ├── .changeset ├── config.json └── README.md ├── .dockerignore ├── pnpm-workspace.yaml ├── turbo.json └── README.md /supabase/seed.sql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /patches/README.md: -------------------------------------------------------------------------------- 1 | Patches -------------------------------------------------------------------------------- /vscode-extension/.gitignore: -------------------------------------------------------------------------------- 1 | apps/visualizer -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/.gitignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /apps/cli/example/pg/external.ts: -------------------------------------------------------------------------------- 1 | export const info = "test"; 2 | -------------------------------------------------------------------------------- /supabase/.gitignore: -------------------------------------------------------------------------------- 1 | # Supabase 2 | .branches 3 | .temp 4 | .env 5 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | SUPABASE_AUTH_GITHUB_CLIENT_ID= 2 | SUPABASE_AUTH_GITHUB_SECRET= -------------------------------------------------------------------------------- /packages/api/src/extensions/index.ts: -------------------------------------------------------------------------------- 1 | export { explain } from "./explain"; 2 | -------------------------------------------------------------------------------- /packages/visualizer/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/api/src/sql/index.ts: -------------------------------------------------------------------------------- 1 | export { splitSqlStatements } from "./utils"; 2 | -------------------------------------------------------------------------------- /supabase/README.md: -------------------------------------------------------------------------------- 1 | # This is to run Supabase locally 2 | 3 | TODO: add instructions -------------------------------------------------------------------------------- /apps/drizzle-run/.drizzle-lab/client.json: -------------------------------------------------------------------------------- 1 | [{"id":"playground","position":{"x":-320,"y":-360}}] -------------------------------------------------------------------------------- /packages/api/src/relations/index.ts: -------------------------------------------------------------------------------- 1 | export { relationsToTypeScript } from "./typescript"; 2 | -------------------------------------------------------------------------------- /apps/cli/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | /.cache 4 | build 5 | dist 6 | .env 7 | .drizzle-lab/ -------------------------------------------------------------------------------- /apps/drizzle-run/.drizzle-lab/visualizer.json: -------------------------------------------------------------------------------- 1 | [{"id":"playground","position":{"x":-200,"y":-60}}] -------------------------------------------------------------------------------- /packages/api/src/extensions/symbols.ts: -------------------------------------------------------------------------------- 1 | export const DrizzleLab = Symbol.for("drizzle:lab"); 2 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/utils/is-browser.ts: -------------------------------------------------------------------------------- 1 | export const isBrowser = typeof document !== "undefined"; 2 | -------------------------------------------------------------------------------- /apps/cli/public/error.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/apps/cli/public/error.webp -------------------------------------------------------------------------------- /apps/cli/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/apps/cli/public/favicon.png -------------------------------------------------------------------------------- /vscode-extension/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/vscode-extension/icon.png -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [rphlmr, drizzle-team] 4 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/routes/_.$.tsx: -------------------------------------------------------------------------------- 1 | export default function NotFound() { 2 | return
Not found
; 3 | } 4 | -------------------------------------------------------------------------------- /packages/api/src/pg/index.node.ts: -------------------------------------------------------------------------------- 1 | export * from "."; 2 | export { importFromFiles } from "./loader/files.node.ts"; 3 | -------------------------------------------------------------------------------- /shared/eslint-config/README.md: -------------------------------------------------------------------------------- 1 | # `@turbo/eslint-config` 2 | 3 | Collection of internal eslint configurations. 4 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "printWidth": 120 5 | } 6 | -------------------------------------------------------------------------------- /packages/api/src/sqlite/index.node.ts: -------------------------------------------------------------------------------- 1 | export * from "."; 2 | export { importFromFiles } from "./loader/files.node.ts"; 3 | -------------------------------------------------------------------------------- /vscode-extension/media/drizzle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/vscode-extension/media/drizzle.png -------------------------------------------------------------------------------- /apps/drizzle-run/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/apps/drizzle-run/public/favicon.ico -------------------------------------------------------------------------------- /apps/cli/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /apps/drizzle-run/.drizzle-lab/server.json: -------------------------------------------------------------------------------- 1 | [{"id":"playground","position":{"x":0,"y":-180}},{"id":"user","position":{"x":460,"y":20}}] -------------------------------------------------------------------------------- /apps/drizzle-run/types/reset.d.ts: -------------------------------------------------------------------------------- 1 | // Do not add any other lines of code to this file! 2 | import "@total-typescript/ts-reset"; 3 | -------------------------------------------------------------------------------- /packages/api/src/mysql/index.node.ts: -------------------------------------------------------------------------------- 1 | export * from "./index.ts"; 2 | export { importFromFiles } from "./loader/files.node.ts"; 3 | -------------------------------------------------------------------------------- /shared/typescript-config/reset.d.ts: -------------------------------------------------------------------------------- 1 | // Do not add any other lines of code to this file! 2 | import "@total-typescript/ts-reset"; 3 | -------------------------------------------------------------------------------- /vscode-extension/media/drizzle_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/vscode-extension/media/drizzle_dark.png -------------------------------------------------------------------------------- /shared/ui/types/icon-name.d.ts: -------------------------------------------------------------------------------- 1 | // This file is a fallback until you run npm run icons build 2 | 3 | export type IconName = string; 4 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files-barrel/schemas/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./users"; 2 | export * from "./posts"; 3 | export * from "./relations"; 4 | -------------------------------------------------------------------------------- /apps/drizzle-run/types/icon-name.d.ts: -------------------------------------------------------------------------------- 1 | // This file is a fallback until you run npm run icons build 2 | 3 | export type IconName = string; 4 | -------------------------------------------------------------------------------- /packages/api/src/pg/index.web.ts: -------------------------------------------------------------------------------- 1 | export type { Snapshot } from "./schema"; 2 | export { schemaToSnapshot } from "./serializer/snapshot"; 3 | -------------------------------------------------------------------------------- /apps/drizzle-run/public/fonts/Inter-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/apps/drizzle-run/public/fonts/Inter-Medium.ttf -------------------------------------------------------------------------------- /apps/drizzle-run/public/fonts/Inter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rphlmr/drizzle-lab/HEAD/apps/drizzle-run/public/fonts/Inter-Regular.ttf -------------------------------------------------------------------------------- /packages/api/src/mysql/index.web.ts: -------------------------------------------------------------------------------- 1 | export { schemaToSnapshot } from "./serializer/snapshot"; 2 | 3 | export type { Snapshot } from "./schema"; 4 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/utils.ts: -------------------------------------------------------------------------------- 1 | import { sql } from "drizzle-orm/sql"; 2 | 3 | export function now() { 4 | return sql`now()`; 5 | } 6 | -------------------------------------------------------------------------------- /packages/api/src/sqlite/index.web.ts: -------------------------------------------------------------------------------- 1 | export { schemaToSnapshot } from "./serializer/snapshot"; 2 | 3 | export type { Snapshot } from "./schema"; 4 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files-barrel/enums.ts: -------------------------------------------------------------------------------- 1 | import { pgEnum } from "drizzle-orm/pg-core"; 2 | 3 | export const postTypeEnum = pgEnum("post_type", ["mobile_app", "web_app"]); 4 | -------------------------------------------------------------------------------- /packages/visualizer/src/index.ts: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import "./style.css"; 4 | 5 | export * from "./compute"; 6 | export * from "./legend"; 7 | export * from "./visualizer"; 8 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files-barrel/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./enums"; 2 | export * from "./schemas/posts"; 3 | export * from "./schemas/users"; 4 | export * from "./schemas/relations"; 5 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/README.md: -------------------------------------------------------------------------------- 1 | TODO: add instructions 2 | 3 | `db:generate` does not use `drizzle.config.ts` because Firefox is unable to handle `require("not/node_module/file.ts")` -------------------------------------------------------------------------------- /vscode-extension/README.md: -------------------------------------------------------------------------------- 1 | # Drizzle ORM VSCode Extension 2 | 3 | 4 | image 5 | -------------------------------------------------------------------------------- /shared/ui/src/icons/README.md: -------------------------------------------------------------------------------- 1 | # Icons 2 | 3 | This directory contains SVG icons that are used by the app. 4 | 5 | Everything in this directory is generated by running `icons build`. 6 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/_blank/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../manifest.schema.json", 3 | "name": "Blank", 4 | "description": "Start from scratch" 5 | } 6 | -------------------------------------------------------------------------------- /packages/api/src/config/index.node.ts: -------------------------------------------------------------------------------- 1 | export type { Config, PartialConfig } from "./loader.node.ts"; 2 | export { importDrizzleConfig } from "./loader.node.ts"; 3 | export * from "./env.node.ts"; 4 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/_blank/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../manifest.schema.json", 3 | "name": "Blank", 4 | "description": "Start from scratch" 5 | } 6 | -------------------------------------------------------------------------------- /apps/drizzle-run/types/brand.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | 3 | declare global { 4 | declare const brand: unique symbol; 5 | 6 | export type Brand = T & { [brand]: TBrand }; 7 | } 8 | -------------------------------------------------------------------------------- /shared/ui/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "outputs": ["dist/**"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/routes.ts: -------------------------------------------------------------------------------- 1 | import type { RouteConfig } from "@react-router/dev/routes"; 2 | import { flatRoutes } from "@react-router/fs-routes"; 3 | 4 | export default flatRoutes() satisfies RouteConfig; 5 | -------------------------------------------------------------------------------- /apps/drizzle-run/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | future: { 5 | unstable_optimizeDeps: true, 6 | }, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/ui/icons/README.md: -------------------------------------------------------------------------------- 1 | # Icons 2 | 3 | This directory contains SVG icons that are used by the app. 4 | 5 | Everything in this directory is generated by running `icons build`. 6 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/core/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any utilities you want to use in the playground 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | -------------------------------------------------------------------------------- /shared/ui/src/utils/cn.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/core/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any utilities you want to use in the playground 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/_blank/db.ts: -------------------------------------------------------------------------------- 1 | // Do not commit this file, it is replaced by the template db file 2 | // This file is only used to type-check the preset 3 | 4 | export const db = {}; 5 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/_blank/db.ts: -------------------------------------------------------------------------------- 1 | // Do not commit this file, it is replaced by the template db file 2 | // This file is only used to type-check the preset 3 | 4 | export const db = {}; 5 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/starter-01/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../manifest.schema.json", 3 | "name": "Simple example", 4 | "description": "A simple example to start with" 5 | } 6 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/utils/cn.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/starter-01/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../manifest.schema.json", 3 | "name": "Simple example", 4 | "description": "A simple example to start with" 5 | } 6 | -------------------------------------------------------------------------------- /packages/visualizer/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/core/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Write your code here 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | 6 | import { db } from "./db"; 7 | import {} from "./schema"; 8 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/core/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Write your code here 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | 6 | import { db } from "./db"; 7 | import {} from "./schema"; 8 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/_blank/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Write your code here 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | 6 | import { db } from "./db"; 7 | import {} from "./schema"; 8 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/_blank/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Write your code here 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | 6 | import { db } from "./db"; 7 | import {} from "./schema"; 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .turbo 3 | **/.cache 4 | build/ 5 | dist 6 | *.env* 7 | !*.env.example 8 | 9 | templates/*/drizzle 10 | container 11 | *.wasm 12 | .drizzle/ 13 | *.vsix 14 | *.tgz 15 | 16 | # React Router 17 | **/.react-router/ 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/rls/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../manifest.schema.json", 3 | "name": "(Experimental) Row Level Security (RLS)", 4 | "description": "A demo of RLS with a Supabase emulator" 5 | } 6 | -------------------------------------------------------------------------------- /vscode-extension/.vscodeignore: -------------------------------------------------------------------------------- 1 | .. 2 | ../../ 3 | vsc-extension-quickstart.md 4 | .vscode/** 5 | .vscode-test/** 6 | .vscode-test* 7 | .gitignore 8 | tsconfig.json 9 | src 10 | .eslintignore 11 | .eslint* 12 | .prettierignore 13 | *.vsix 14 | node_modules -------------------------------------------------------------------------------- /apps/cli/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/node-library.json", 3 | "include": [ 4 | "**/*.d.ts", 5 | "**/*.ts", 6 | "../../shared/typescript-config/reset.d.ts" 7 | ], 8 | "exclude": ["node_modules"] 9 | } 10 | -------------------------------------------------------------------------------- /shared/eslint-plugin-node-imports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/eslint-plugin-node-imports", 3 | "version": "0.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "description": "Prevent importing .node.ts files from non-.node.ts files except for type imports" 7 | } 8 | -------------------------------------------------------------------------------- /vscode-extension/src/modules/visualizer/stop-visualizer/command.ts: -------------------------------------------------------------------------------- 1 | import { closeDrizzleVisualizerPanel } from "../panel"; 2 | 3 | export const StopVisualizerCommand = "drizzle.visualizer:stop"; 4 | 5 | export function StopVisualizer() { 6 | closeDrizzleVisualizerPanel(); 7 | } 8 | -------------------------------------------------------------------------------- /apps/cli/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import("eslint").Linter.Config} */ 2 | module.exports = { 3 | root: true, 4 | extends: ["@repo/eslint-config/base.js"], 5 | parserOptions: { 6 | project: true, 7 | }, 8 | ignorePatterns: ["app/registry/*/presets", "**/*/_blank"], 9 | }; 10 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/x.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apps/cli/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import preset from "@repo/ui/config/tailwind"; 2 | import type { Config } from "tailwindcss"; 3 | 4 | const config = { 5 | content: ["./visualizer/**/*.{ts,tsx}", ...preset.content], 6 | presets: [preset], 7 | } satisfies Config; 8 | 9 | export default config; 10 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "~/utils/cn"; 2 | 3 | function Skeleton({ className, ...props }: React.HTMLAttributes) { 4 | return
; 5 | } 6 | 7 | export { Skeleton }; 8 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "connor4312.esbuild-problem-matchers", 6 | "ms-vscode.extension-test-runner", 7 | "biomejs.biome" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.client/migrations/meta/_journal.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "6", 3 | "dialect": "postgresql", 4 | "entries": [ 5 | { 6 | "idx": 0, 7 | "version": "6", 8 | "when": 1719674623916, 9 | "tag": "0000_init", 10 | "breakpoints": true 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /shared/ui/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import("eslint").Linter.Config} */ 2 | module.exports = { 3 | root: true, 4 | extends: ["@repo/eslint-config/base.js"], 5 | parser: "@typescript-eslint/parser", 6 | parserOptions: { 7 | project: true, 8 | }, 9 | ignorePatterns: ["tailwind.config.ts"], 10 | }; 11 | -------------------------------------------------------------------------------- /shared/ui/other/sly.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://sly-cli.fly.dev/registry/config.json", 3 | "libraries": [ 4 | { 5 | "name": "lucide-icons", 6 | "directory": "./other/svg-icons", 7 | "postinstall": ["pnpm", "run", "build:icons"], 8 | "transformers": [] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/core/schema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the schema for the database. 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | * Do not forget to `export` your tables 😅 5 | */ 6 | 7 | import { relations } from "drizzle-orm"; 8 | import {} from "drizzle-orm/pg-core"; 9 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/_blank/schema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the schema for the database. 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | * Do not forget to `export` your tables 😅 5 | */ 6 | 7 | import {} from "drizzle-orm"; 8 | import {} from "drizzle-orm/pg-core"; 9 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/core/schema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the schema for the database. 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | * Do not forget to `export` your tables 😅 5 | */ 6 | 7 | import { relations } from "drizzle-orm"; 8 | import {} from "drizzle-orm/sqlite-core"; 9 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/_blank/schema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the schema for the database. 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | * Do not forget to `export` your tables 😅 5 | */ 6 | 7 | import {} from "drizzle-orm"; 8 | import {} from "drizzle-orm/sqlite-core"; 9 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/utils/query-logger.ts: -------------------------------------------------------------------------------- 1 | import type { Query } from "drizzle-orm/sql"; 2 | 3 | export type QueryLog = Query & { 4 | type: "query-log"; 5 | }; 6 | 7 | export function isQueryLog(data: unknown): data is QueryLog { 8 | return data != null && (data as QueryLog).type === "query-log"; 9 | } 10 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/sly.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://sly-cli.fly.dev/registry/config.json", 3 | "libraries": [ 4 | { 5 | "name": "lucide-icons", 6 | "directory": "./other/svg-icons", 7 | "postinstall": ["pnpm", "run", "build:icons"], 8 | "transformers": [] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /vscode-extension/src/modules/studio/stop-studio/command.ts: -------------------------------------------------------------------------------- 1 | import { closeDrizzleStudioPanel } from "../panel"; 2 | import { stopStudio } from "../server"; 3 | 4 | export const StopStudioCommand = "drizzle.studio:stop"; 5 | 6 | export function StopStudio() { 7 | stopStudio(); 8 | closeDrizzleStudioPanel(); 9 | } 10 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/rls/db.ts: -------------------------------------------------------------------------------- 1 | // Do not commit this file, it is replaced by the template db file 2 | // This file is only used to type-check the preset 3 | 4 | import * as schema from "./schema"; 5 | import { Database } from "../../core/db"; 6 | 7 | export const db = await Database(schema); 8 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/starter-01/db.ts: -------------------------------------------------------------------------------- 1 | // Do not commit this file, it is replaced by the template db file 2 | // This file is only used to type-check the preset 3 | 4 | import * as schema from "./schema"; 5 | import { Database } from "../../core/db"; 6 | 7 | export const db = await Database(schema); 8 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/starter-01/db.ts: -------------------------------------------------------------------------------- 1 | // Do not commit this file, it is replaced by the template db file 2 | // This file is only used to type-check the preset 3 | 4 | import * as schema from "./schema"; 5 | import { Database } from "../../core/db"; 6 | 7 | export const db = await Database(schema); 8 | -------------------------------------------------------------------------------- /shared/typescript-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/typescript-config", 3 | "version": "0.0.0", 4 | "private": true, 5 | "license": "MIT", 6 | "publishConfig": { 7 | "access": "public" 8 | }, 9 | "devDependencies": { 10 | "@total-typescript/ts-reset": "^0.5.1" 11 | }, 12 | "prettier": {} 13 | } 14 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": true, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "public", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /shared/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/react-library.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "types": ["vite/client", "node"], 6 | "jsx": "react-jsx", 7 | "noEmit": true 8 | }, 9 | "include": ["**/*.ts", "**/*.tsx"], 10 | "exclude": ["node_modules", "dist"] 11 | } 12 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | .git 4 | .idea 5 | .turbo 6 | .cache 7 | .DS_Store 8 | .dockerignore 9 | .gitignore 10 | .prettierignore 11 | .prettierrc 12 | .*.* 13 | !.*.client.* 14 | 15 | build/ 16 | dist/ 17 | *.env* 18 | !*.env.example 19 | supabase 20 | **/fly.* 21 | *.vsix 22 | vscode-extension 23 | drizzle-lab.tgz 24 | !.changeset/ -------------------------------------------------------------------------------- /apps/drizzle-run/app/utils/robot.ts: -------------------------------------------------------------------------------- 1 | export const robot = { 2 | public: [ 3 | { name: "robots", content: "index,follow" }, 4 | { name: "googlebot", content: "index,follow" }, 5 | ], 6 | private: [ 7 | { name: "robots", content: "noindex,nofollow" }, 8 | { name: "googlebot", content: "noindex,nofollow" }, 9 | ], 10 | }; 11 | -------------------------------------------------------------------------------- /packages/visualizer/src/components/theme.ts: -------------------------------------------------------------------------------- 1 | import { createContext, useContext } from "react"; 2 | 3 | export type Theme = "dark" | "light"; 4 | 5 | const ThemeContext = createContext("dark"); 6 | 7 | export const ThemeProvider = ThemeContext.Provider; 8 | 9 | export function useTheme() { 10 | return useContext(ThemeContext); 11 | } 12 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/entry.client.tsx: -------------------------------------------------------------------------------- 1 | import { StrictMode, startTransition } from "react"; 2 | import { hydrateRoot } from "react-dom/client"; 3 | import { HydratedRouter } from "react-router/dom"; 4 | 5 | startTransition(() => { 6 | hydrateRoot( 7 | document, 8 | 9 | 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /shared/typescript-config/react-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React Library", 4 | "extends": "./base", 5 | "include": ["**/*.ts", "**/*.tsx"], 6 | "exclude": ["node_modules"], 7 | "compilerOptions": { 8 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 9 | "jsx": "react-jsx" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /shared/ui/src/components/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "../utils/cn"; 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ); 13 | } 14 | 15 | export { Skeleton }; 16 | -------------------------------------------------------------------------------- /packages/api/src/pg/utils.ts: -------------------------------------------------------------------------------- 1 | export const vectorOps = [ 2 | "vector_l2_ops", 3 | "vector_ip_ops", 4 | "vector_cosine_ops", 5 | "vector_l1_ops", 6 | "bit_hamming_ops", 7 | "bit_jaccard_ops", 8 | "halfvec_l2_ops", 9 | "sparsevec_l2_ops", 10 | ]; 11 | 12 | export function isPgArrayType(sqlType: string) { 13 | return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null; 14 | } 15 | -------------------------------------------------------------------------------- /packages/visualizer/demo/main.tsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from "react"; 2 | import { createRoot } from "react-dom/client"; 3 | import App from "./app.tsx"; 4 | 5 | const root = document.getElementById("root"); 6 | 7 | if (!root) { 8 | throw new Error("Root element not found"); 9 | } 10 | 11 | createRoot(root).render( 12 | 13 | 14 | 15 | ); 16 | -------------------------------------------------------------------------------- /packages/visualizer/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.client/migrations/0000_init.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "playground" ( 2 | "id" text PRIMARY KEY NOT NULL, 3 | "name" text NOT NULL, 4 | "description" text, 5 | "dialect" text NOT NULL, 6 | "content" jsonb NOT NULL, 7 | "creator_id" uuid, 8 | "created_at" timestamp(3) DEFAULT NOW() NOT NULL, 9 | "updated_at" timestamp(3) NOT NULL, 10 | "forked_from_id" text 11 | ); -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files/schemas/users.ts: -------------------------------------------------------------------------------- 1 | import { explain } from "@drizzle-lab/api/extensions"; 2 | import { pgTable, serial, text } from "drizzle-orm/pg-core"; 3 | 4 | export const users = pgTable("users", { 5 | id: serial("id").primaryKey(), 6 | name: text("name"), 7 | }); 8 | 9 | explain(users, { 10 | description: "My super Users table", 11 | columns: { 12 | id: "Auto incrementing ID", 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.client/schema.ts: -------------------------------------------------------------------------------- 1 | import { pgTable } from "drizzle-orm/pg-core"; 2 | 3 | import { playgroundColumns } from "~/database/shared"; 4 | 5 | /** 6 | * These schemas are used by PGLite in the browser (IndexedDB) 7 | */ 8 | 9 | /* -- Drizzle Run -- */ 10 | /* -- Playground -- */ 11 | 12 | const playground = pgTable("playground", { 13 | ...playgroundColumns, 14 | }); 15 | 16 | export { playground }; 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/chevron-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/play.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files-barrel/schemas/users.ts: -------------------------------------------------------------------------------- 1 | import { explain } from "@drizzle-lab/api/extensions"; 2 | import { pgTable, serial, text } from "drizzle-orm/pg-core"; 3 | 4 | export const users = pgTable("users", { 5 | id: serial("id").primaryKey(), 6 | name: text("name"), 7 | }); 8 | 9 | explain(users, { 10 | description: "My super Users table", 11 | columns: { 12 | id: "Auto incrementing ID", 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/chevron-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/play.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/cli/example/multi-packages/package-users/database/schema.ts: -------------------------------------------------------------------------------- 1 | import { explain } from "@drizzle-lab/api/extensions"; 2 | import { pgTable, serial, text } from "drizzle-orm/pg-core"; 3 | 4 | export const users = pgTable("users", { 5 | id: serial("id").primaryKey(), 6 | name: text("name"), 7 | }); 8 | 9 | explain(users, { 10 | description: "My super Users table", 11 | columns: { 12 | id: "Auto incrementing ID", 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/starter-01/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Write your code here 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | 6 | import { db } from "./db"; 7 | import {} from "./schema"; 8 | 9 | // 💡 This playground run a seed code in the Seed tab 10 | 11 | const result = await db.query.users.findMany({ 12 | with: { 13 | posts: true, 14 | }, 15 | }); 16 | 17 | console.log(result); 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/starter-01/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Write your code here 3 | * 💡Tip: you can use the `$` global variable to access goodies 4 | */ 5 | 6 | import { db } from "./db"; 7 | import {} from "./schema"; 8 | 9 | // 💡 This playground run a seed code in the Seed tab 10 | 11 | const result = await db.query.users.findMany({ 12 | with: { 13 | posts: true, 14 | }, 15 | }); 16 | 17 | console.log(result); 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/chevrons-up-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/chevrons-up-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "css/base.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "ui": "src/components", 15 | "components": "src/components", 16 | "utils": "src/utils/cn" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/user-round.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/drizzle.client.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the client-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./app/database/.client"; 8 | const migrationsFolder = `${base}/migrations`; 9 | 10 | export default defineConfig({ 11 | dialect: "postgresql", 12 | schema: `${base}/schema.ts`, 13 | out: migrationsFolder, 14 | verbose: false, 15 | }); 16 | 17 | export { migrationsFolder }; 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/code.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/panel-top.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/code.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/user-round.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/panel-top.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/info.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.server/migrations/meta/_journal.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "6", 3 | "dialect": "postgresql", 4 | "entries": [ 5 | { 6 | "idx": 0, 7 | "version": "6", 8 | "when": 1719674631347, 9 | "tag": "0000_init", 10 | "breakpoints": true 11 | }, 12 | { 13 | "idx": 1, 14 | "version": "7", 15 | "when": 1724449193516, 16 | "tag": "0001_unknown_unicorn", 17 | "breakpoints": true 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/core/seed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any seeding code you want to use in the playground 3 | * It will be executed first before your playground code 4 | * 💡Tip: you can use the `$` global variable to access goodies 5 | */ 6 | 7 | import { seed } from "drizzle-seed"; 8 | 9 | import { db } from "./db"; 10 | import * as schema from "./schema"; 11 | 12 | // doc: https://orm.drizzle.team/docs/seed-overview 13 | await seed(db, schema); 14 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/core/seed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any seeding code you want to use in the playground 3 | * It will be executed first before your playground code 4 | * 💡Tip: you can use the `$` global variable to access goodies 5 | */ 6 | 7 | import { seed } from "drizzle-seed"; 8 | 9 | import { db } from "./db"; 10 | import * as schema from "./schema"; 11 | 12 | // doc: https://orm.drizzle.team/docs/seed-overview 13 | await seed(db, schema); 14 | -------------------------------------------------------------------------------- /apps/drizzle-run/drizzle.server.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./app/database/.server"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.DATABASE_URL_MIGRATE!, 13 | }, 14 | schema: [`${base}/schema.ts`, `${base}/relations.ts`], 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | }); 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/info.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/lock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/routes/auth.sign-out/route.tsx: -------------------------------------------------------------------------------- 1 | import { type MetaFunction, redirect } from "react-router"; 2 | import { robot } from "~/utils/robot"; 3 | import type { Route } from "./+types/route"; 4 | 5 | export const meta: MetaFunction = () => { 6 | return robot.private; 7 | }; 8 | 9 | export function action({ context }: Route.ActionArgs) { 10 | context.destroyAuthSession(); 11 | 12 | throw redirect("/"); 13 | } 14 | 15 | export default function View() { 16 | return null; 17 | } 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/captions.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/captions.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/lock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.client/migrations/export.json: -------------------------------------------------------------------------------- 1 | [{"sql":["CREATE TABLE IF NOT EXISTS \"playground\" (\n\t\"id\" text PRIMARY KEY NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"description\" text,\n\t\"dialect\" text NOT NULL,\n\t\"content\" jsonb NOT NULL,\n\t\"creator_id\" uuid,\n\t\"created_at\" timestamp(3) DEFAULT NOW() NOT NULL,\n\t\"updated_at\" timestamp(3) NOT NULL,\n\t\"forked_from_id\" text\n);"],"bps":true,"folderMillis":1719674623916,"hash":"54675cacaaab25d18f193421b4102e6fa3d0bcf6a26d365831db457e0757c5f7"}] -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/ellipsis-vertical.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/arrow-right-left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/circle-user-round.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/history.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/modules/playground/highlighter.ts: -------------------------------------------------------------------------------- 1 | import { createHighlighter } from "shiki/bundle/web"; 2 | import tokyoNight from "shiki/themes/tokyo-night.mjs"; 3 | 4 | export const highlighter = await createHighlighter({ 5 | themes: [ 6 | { 7 | ...tokyoNight, 8 | colors: { 9 | ...tokyoNight.colors, 10 | "editor.background": "transparent", 11 | "editorGutter.background": "#00000000", 12 | }, 13 | }, 14 | ], 15 | langs: ["typescript", "json", "sql"], 16 | }); 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/ellipsis-vertical.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/history.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/database.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/diamond.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 15 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/settings-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/square-terminal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/arrow-right-left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/circle-user-round.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/database.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/square-terminal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/book-text.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/book-text.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/diamond.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/settings-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/cloud-upload.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/external-link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/scripts/export-local-db-migrations.ts: -------------------------------------------------------------------------------- 1 | import fs from "node:fs/promises"; 2 | 3 | import { readMigrationFiles } from "drizzle-orm/migrator"; 4 | 5 | import { migrationsFolder } from "../../../drizzle.client.config"; 6 | 7 | const file = "app/database/.client/migrations/export.json"; 8 | 9 | await fs.writeFile( 10 | `${file}`, 11 | JSON.stringify( 12 | readMigrationFiles({ 13 | migrationsFolder, 14 | }), 15 | null, 16 | 0, 17 | ), 18 | { 19 | flag: "w", 20 | }, 21 | ); 22 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/meta.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "id": "meta.schema.json", 4 | "description": "A schema for the meta.json file in a preset", 5 | "type": "object", 6 | "properties": { 7 | "name": { 8 | "type": "string", 9 | "description": "The name of the preset" 10 | }, 11 | "description": { 12 | "type": "string", 13 | "description": "A description of the preset" 14 | } 15 | }, 16 | "required": ["name", "description"] 17 | } 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/cloud-upload.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/external-link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/camera.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/log-out.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/share.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /apps/cli/example/sqlite/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/sqlite"; 8 | 9 | export default defineConfig({ 10 | dialect: "sqlite", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: `${base}/schema.ts`, 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | casing: "snake_case", 18 | migrations: { 19 | prefix: "timestamp", 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/camera.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/share.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/clipboard.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/eye.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/ghost.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/triangle-alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/ghost.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/log-out.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/visualizer/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "", 8 | "css": "src/styles.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "~/components", 15 | "utils": "~/lib/utils", 16 | "ui": "~/components/ui", 17 | "lib": "~/lib", 18 | "hooks": "~/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } 22 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/eraser.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/manifest.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "id": "meta.schema.json", 4 | "description": "A schema for the meta.json file in a preset", 5 | "type": "object", 6 | "properties": { 7 | "name": { 8 | "type": "string", 9 | "description": "The name of the preset" 10 | }, 11 | "description": { 12 | "type": "string", 13 | "description": "A description of the preset" 14 | } 15 | }, 16 | "required": ["name", "description"] 17 | } 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/clipboard.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/eye.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/triangle-alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - apps/drizzle-run 3 | - packages/* 4 | - vscode-extension 5 | 6 | catalog: 7 | "@tailwindcss/vite": ^4.1.12 8 | "@types/node": ^22.18.0 9 | "@types/react": ^19.1.12 10 | "@types/react-dom": ^19.1.9 11 | class-variance-authority: ^0.7.1 12 | clsx: ^2.1.1 13 | react: ^19.1.1 14 | react-dom: ^19.1.1 15 | tailwind-merge: ^3.3.1 16 | tailwindcss: ^4.1.12 17 | tailwindcss-animate: ^1.0.7 18 | tw-animate-css: ^1.3.7 19 | typescript: ^5.9.2 20 | vite: ^7.1.3 21 | vite-tsconfig-paths: ^5.1.4 22 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/types.ts: -------------------------------------------------------------------------------- 1 | import type * as clientSchema from "~/database/.client/schema"; 2 | import type * as serverSchema from "~/database/.server/schema"; 3 | 4 | /* -- Brands -- */ 5 | export type UserId = Brand; 6 | export type PlaygroundId = Brand; 7 | 8 | /* -- Models -- */ 9 | export type User = typeof serverSchema.user.$inferSelect; 10 | export type Playground = Omit< 11 | typeof serverSchema.playground.$inferSelect, 12 | "fts" 13 | > & 14 | typeof clientSchema.playground.$inferSelect; 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/eraser.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/file-pen-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/wrench.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/wrench.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/sqlite/presets/starter-01/seed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any seeding code you want to use in the playground 3 | * It will be executed first before your playground code 4 | * 💡Tip: you can use the `$` global variable to access goodies 5 | */ 6 | 7 | import { seed } from "drizzle-seed"; 8 | 9 | import { db } from "./db"; 10 | import { posts, users } from "./schema"; 11 | 12 | // doc: https://orm.drizzle.team/docs/seed-overview 13 | // @ts-ignore - temporary fix for drizzle-seed 14 | await seed(db, { posts, users }); 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/file-pen-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/braces.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/shield.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/cli/example/mysql/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/mysql"; 8 | 9 | export default defineConfig({ 10 | dialect: "mysql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: `${base}/schema.ts`, 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | }); 23 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/braces.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/shield.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /shared/typescript-config/remix.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Remix", 4 | "extends": "./base", 5 | "include": [ 6 | "**/*.ts", 7 | "**/*.tsx", 8 | "**/.server/**/*.ts", 9 | "**/.server/**/*.tsx", 10 | "**/.client/**/*.ts", 11 | "**/.client/**/*.tsx" 12 | ], 13 | "exclude": ["node_modules"], 14 | "compilerOptions": { 15 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 16 | "jsx": "react-jsx", 17 | "types": ["@remix-run/node", "vite/client"], 18 | "noEmit": true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.server/migrations/0001_unknown_unicorn.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "playground" ADD COLUMN "fts" "tsvector" GENERATED ALWAYS AS (to_tsvector('english',coalesce("playground"."name", '') || ' ' || coalesce("playground"."description", ''))) STORED;--> statement-breakpoint 2 | CREATE INDEX IF NOT EXISTS "dialect_idx" ON "playground" USING btree ("dialect");--> statement-breakpoint 3 | CREATE INDEX IF NOT EXISTS "playground_search_index" ON "playground" USING gin ("fts");--> statement-breakpoint 4 | CREATE INDEX IF NOT EXISTS "username_idx" ON "user" USING btree ("username"); -------------------------------------------------------------------------------- /packages/visualizer/demo/app.tsx: -------------------------------------------------------------------------------- 1 | import { DrizzleVisualizer, DrizzleVisualizerLegend } from "../src"; 2 | import * as schema from "./schema"; 3 | 4 | import "../src/style.css"; 5 | 6 | export default function App() { 7 | return ( 8 |
16 | 17 | 18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/shrink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/shrink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/clipboard-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/cloud-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/cloud-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/box.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/folder-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/clipboard-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/folder-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/visualizer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | Vite + React + TS 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/book-image.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/git-fork.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/box.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/utils/assert.ts: -------------------------------------------------------------------------------- 1 | import type { ErrorActorEvent, EventObject } from "xstate"; 2 | 3 | function assertNonNull( 4 | value: T | null | undefined, 5 | ): asserts value is NonNullable { 6 | if (!value) { 7 | throw new Error("Value is null or undefined"); 8 | } 9 | } 10 | 11 | function assertIsActorError( 12 | event: EventObject, 13 | ): asserts event is ErrorActorEvent { 14 | if (!event.type.startsWith("xstate.error.actor")) { 15 | throw new Error("Event is not an actor error"); 16 | } 17 | } 18 | 19 | export { assertNonNull, assertIsActorError }; 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/book-image.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/git-fork.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/badge-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/list-restart.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/list-restart.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/image-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/save.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/shield-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/badge-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/save.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/shield-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/image-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/typescript-config/base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Default", 4 | "compilerOptions": { 5 | "lib": ["ES2022"], 6 | "isolatedModules": true, 7 | "esModuleInterop": true, 8 | "module": "ESNext", 9 | "moduleResolution": "Bundler", 10 | "resolveJsonModule": true, 11 | "target": "ES2022", 12 | "strict": true, 13 | "allowJs": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "skipLibCheck": true, 16 | "noEmit": true 17 | }, 18 | "includes": ["./reset.d.ts"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/captions-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/starter-01/seed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any seeding code you want to use in the playground 3 | * It will be executed first before your playground code 4 | * 💡Tip: you can use the `$` global variable to access goodies 5 | */ 6 | 7 | import { drizzle } from "drizzle-orm/pglite"; 8 | import { seed } from "drizzle-seed"; 9 | 10 | import { db } from "./db"; 11 | import { posts, users } from "./schema"; 12 | 13 | // doc: https://orm.drizzle.team/docs/seed-overview 14 | // @ts-ignore - temporary fix for drizzle-seed 15 | await seed(db, { posts, users }); 16 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/share-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/trash-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/captions-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/share-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/trash-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/api/src/mysql/index.ts: -------------------------------------------------------------------------------- 1 | export { importFromDatabase } from "./loader/database"; 2 | export type { DrizzleObjects } from "./serializer/drizzle-objects"; 3 | export { schemaToDrizzleObjects } from "./serializer/drizzle-objects"; 4 | export { 5 | drizzleObjectsToSnapshot, 6 | schemaToSnapshot, 7 | } from "./serializer/snapshot"; 8 | export { 9 | drizzleObjectsToSql, 10 | schemaToSql, 11 | schemaToSqlStatements, 12 | snapshotToSql, 13 | snapshotToSqlStatements, 14 | } from "./serializer/sql"; 15 | export { snapshotToTypeScript } from "./serializer/typescript"; 16 | export type { Snapshot } from "./schema"; 17 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/loader-pinwheel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/loader-pinwheel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/sheet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/sheet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/key-round.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.server/db.ts: -------------------------------------------------------------------------------- 1 | import { drizzle } from "drizzle-orm/postgres-js"; 2 | import postgres from "postgres"; 3 | 4 | import { env } from "~/utils/env"; 5 | 6 | import * as relations from "./relations"; 7 | import * as schema from "./schema"; 8 | 9 | const client = postgres(env.DATABASE_URL, { prepare: false, max: 10 }); 10 | 11 | const db = drizzle({ 12 | client, 13 | schema: { 14 | ...schema, 15 | ...relations, 16 | }, 17 | casing: "snake_case", 18 | logger: env.NODE_ENV === "development", 19 | }); 20 | 21 | const serverDb = Object.assign(db, { 22 | schema, 23 | }); 24 | 25 | export { serverDb }; 26 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/key-round.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/dialects/postgresql/presets/rls/seed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Here you can write any seeding code you want to use in the playground 3 | * It will be executed first before your playground code 4 | * 💡Tip: you can use the `$` global variable to access goodies 5 | */ 6 | 7 | import { sql } from "drizzle-orm"; 8 | 9 | import { db } from "./db"; 10 | 11 | await db.execute(sql` 12 | create or replace function auth.uid() returns uuid as $$ 13 | select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid; 14 | $$ language sql stable; 15 | `); 16 | 17 | await db.execute(sql` 18 | GRANT postgres TO authenticated; 19 | `); 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/registry/presets.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest"; 2 | 3 | import { type Dialect, getCoreFiles, getPresetFiles, getPresetsManifest } from "."; 4 | 5 | test("Registry presets are valid", async () => { 6 | const presetsManifest = getPresetsManifest(); 7 | const dialects = Object.keys(presetsManifest) as Dialect[]; 8 | const promises = []; 9 | 10 | for (const dialect of dialects) { 11 | promises.push(getCoreFiles(dialect)); 12 | 13 | for (const preset of presetsManifest[dialect]) { 14 | promises.push(getPresetFiles(dialect, preset.id)); 15 | } 16 | } 17 | 18 | await Promise.all(promises); 19 | }); 20 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/view.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/view.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/box-plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /apps/cli/visualizer/entry.client.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * By default, Remix will handle hydrating your app on the client for you. 3 | * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ 4 | * For more information, see https://remix.run/file-conventions/entry.client 5 | */ 6 | 7 | import { startTransition, StrictMode } from "react"; 8 | 9 | import { RemixBrowser } from "@remix-run/react"; 10 | import { hydrateRoot } from "react-dom/client"; 11 | 12 | startTransition(() => { 13 | hydrateRoot( 14 | document, 15 | 16 | 17 | , 18 | ); 19 | }); 20 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/toolbar.tsx: -------------------------------------------------------------------------------- 1 | import { createPortal } from "react-dom"; 2 | import { Separator } from "./ui/separator"; 3 | 4 | const id = "toolbar"; 5 | 6 | export function Toolbar({ children }: { children: React.ReactNode }) { 7 | const outlet = document.getElementById(id); 8 | 9 | if (!outlet) { 10 | return null; 11 | } 12 | 13 | return createPortal( 14 | <> 15 | {children} 16 | 17 | , 18 | outlet 19 | ); 20 | } 21 | 22 | export function ToolbarOutlet({ className }: { className?: string }) { 23 | return
; 24 | } 25 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/box-plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/sprout.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/sprout.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/cable.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docs-template.yaml: -------------------------------------------------------------------------------- 1 | name: "Documentation Enhancement" 2 | description: Suggest documentation improvements 3 | title: "[DOCS]:" 4 | labels: ["docs"] 5 | 6 | body: 7 | - type: checkboxes 8 | id: verified 9 | attributes: 10 | label: Enhancement hasn't been filed before. 11 | options: 12 | - label: I have verified this enhancement I'm about to request hasn't been suggested before. 13 | required: true 14 | 15 | - type: textarea 16 | attributes: 17 | label: Describe the enhancement you want to request 18 | description: What do you want to change or add to the documentation? 19 | validations: 20 | required: true 21 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/database/.server/relations.ts: -------------------------------------------------------------------------------- 1 | import { relations } from "drizzle-orm"; 2 | 3 | import { playground, user } from "./schema"; 4 | 5 | /* -- User -- */ 6 | 7 | const userRelations = relations(user, ({ many }) => ({ 8 | playgrounds: many(playground), 9 | })); 10 | 11 | /* -- Playground -- */ 12 | 13 | const playgroundRelations = relations(playground, ({ one }) => ({ 14 | creator: one(user, { 15 | fields: [playground.creatorId], 16 | references: [user.id], 17 | }), 18 | forkedFrom: one(playground, { 19 | fields: [playground.forkedFromId], 20 | references: [playground.id], 21 | }), 22 | })); 23 | 24 | export { userRelations, playgroundRelations }; 25 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/cable.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-template.yaml: -------------------------------------------------------------------------------- 1 | name: "Feature Request" 2 | description: Suggest new feature 3 | title: "[FEATURE]:" 4 | labels: ["enhancement"] 5 | 6 | body: 7 | - type: checkboxes 8 | id: verified 9 | attributes: 10 | label: Feature hasn't been suggested before. 11 | options: 12 | - label: I have verified this feature I'm about to request hasn't been suggested before. 13 | required: true 14 | 15 | - type: textarea 16 | attributes: 17 | label: Describe the enhancement you want to request 18 | description: What do you want to change or add? What are the benefits of implementing this? 19 | validations: 20 | required: true 21 | -------------------------------------------------------------------------------- /packages/api/src/pg/index.ts: -------------------------------------------------------------------------------- 1 | export type { DrizzleObjects } from "./serializer/drizzle-objects"; 2 | export { importFromDatabase } from "./loader/database"; 3 | export { schemaToDrizzleObjects } from "./serializer/drizzle-objects"; 4 | export { 5 | drizzleObjectsToSnapshot, 6 | schemaToSnapshot, 7 | } from "./serializer/snapshot"; 8 | export { sqlToSnapshot } from "./serializer/sql-to-snapshot"; 9 | export { 10 | drizzleObjectsToSql, 11 | schemaToSql, 12 | schemaToSqlStatements, 13 | snapshotToSql, 14 | snapshotToSqlStatements, 15 | } from "./serializer/sql"; 16 | export { snapshotToTypeScript, sqlToTypescript } from "./serializer/typescript"; 17 | export type { Snapshot } from "./schema"; 18 | -------------------------------------------------------------------------------- /apps/cli/example/pg/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/pg"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: `${base}/schema.ts`, 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | entities: { 23 | roles: { 24 | provider: "supabase", 25 | exclude: ["supabase_auth_admin"], 26 | }, 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /packages/api/src/sqlite/index.ts: -------------------------------------------------------------------------------- 1 | export { importFromDatabase } from "./loader/database"; 2 | export type { DrizzleObjects } from "./serializer/drizzle-objects"; 3 | export { schemaToDrizzleObjects } from "./serializer/drizzle-objects"; 4 | export { 5 | drizzleObjectsToSnapshot, 6 | schemaToSnapshot, 7 | } from "./serializer/snapshot"; 8 | export { sqlToSnapshot } from "./serializer/sql-to-snapshot"; 9 | export { 10 | drizzleObjectsToSql, 11 | schemaToSql, 12 | schemaToSqlStatements, 13 | snapshotToSql, 14 | snapshotToSqlStatements, 15 | } from "./serializer/sql"; 16 | export { snapshotToTypeScript, sqlToTypescript } from "./serializer/typescript"; 17 | export type { Snapshot } from "./schema"; 18 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false, // set this to true to hide the "out" folder with the compiled JS files 5 | "dist": false // set this to true to hide the "dist" folder with the compiled JS files 6 | }, 7 | "search.exclude": { 8 | "out": true, // set this to false to include "out" folder in search results 9 | "dist": true // set this to false to include "dist" folder in search results 10 | }, 11 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 12 | "typescript.tsc.autoDetect": "off", 13 | "editor.defaultFormatter": "biomejs.biome" 14 | } 15 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/routes/healthcheck.tsx: -------------------------------------------------------------------------------- 1 | // learn more: https://fly.io/docs/reference/configuration/#services-http_checks 2 | import { sql } from "drizzle-orm"; 3 | 4 | import { serverDb } from "~/database/.server/db"; 5 | import { AppError } from "~/utils/error"; 6 | import { failure, success } from "~/utils/http"; 7 | 8 | export async function loader() { 9 | try { 10 | await serverDb.execute(sql`select count(*) from ${serverDb.schema.user}`); 11 | return success({ status: "ok" }); 12 | } catch (cause) { 13 | return failure( 14 | new AppError({ 15 | cause, 16 | message: "Healthcheck failed", 17 | label: "Healthcheck 🏥", 18 | }) 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/multi-files"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: `${base}/schemas`, 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | entities: { 23 | roles: { 24 | provider: "supabase", 25 | exclude: ["supabase_auth_admin"], 26 | }, 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /shared/typescript-config/node-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node Library", 4 | "extends": "./base", 5 | "include": ["**/*.ts", "**/*.node.ts", "**/*.tsx"], 6 | "exclude": ["node_modules"], 7 | "compilerOptions": { 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "target": "ESNext", 11 | "allowJs": true, 12 | "resolveJsonModule": true, 13 | "moduleDetection": "force", 14 | "isolatedModules": true, 15 | "verbatimModuleSyntax": true, 16 | 17 | "strict": true, 18 | "noUncheckedIndexedAccess": false, 19 | "noImplicitOverride": true, 20 | 21 | "module": "ESNext", 22 | "noEmit": true 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files/schemas/relations.ts: -------------------------------------------------------------------------------- 1 | import { relations } from "drizzle-orm"; 2 | 3 | import { posts } from "./posts"; 4 | import { users } from "./users"; 5 | 6 | export const usersRelations = relations(users, ({ many }) => ({ 7 | author: many(posts, { relationName: "author" }), 8 | reviewer: many(posts, { relationName: "reviewer" }), 9 | })); 10 | 11 | export const postsRelations = relations(posts, ({ one }) => ({ 12 | author: one(users, { 13 | fields: [posts.authorId], 14 | references: [users.id], 15 | relationName: "author", 16 | }), 17 | reviewer: one(users, { 18 | fields: [posts.reviewerId], 19 | references: [users.id], 20 | relationName: "reviewer", 21 | }), 22 | })); 23 | -------------------------------------------------------------------------------- /apps/drizzle-run/.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Drizzle Run 2 | APP_URL=http://localhost:3000 3 | DATABASE_URL=postgresql://postgres:postgres@localhost:54322/postgres 4 | DATABASE_URL_MIGRATE=postgresql://postgres:postgres@localhost:54322/postgres 5 | SENTRY_DSN= 6 | SESSION_SECRET=super-duper-s3cret 7 | SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 8 | SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU 9 | SUPABASE_URL=http://127.0.0.1:54321 10 | TZ=UTC 11 | NODE_ENV=development -------------------------------------------------------------------------------- /apps/cli/example/multi-files-barrel/schemas/relations.ts: -------------------------------------------------------------------------------- 1 | import { relations } from "drizzle-orm"; 2 | 3 | import { posts } from "./posts"; 4 | import { users } from "./users"; 5 | 6 | export const usersRelations = relations(users, ({ many }) => ({ 7 | author: many(posts, { relationName: "author" }), 8 | reviewer: many(posts, { relationName: "reviewer" }), 9 | })); 10 | 11 | export const postsRelations = relations(posts, ({ one }) => ({ 12 | author: one(users, { 13 | fields: [posts.authorId], 14 | references: [users.id], 15 | relationName: "author", 16 | }), 17 | reviewer: one(users, { 18 | fields: [posts.reviewerId], 19 | references: [users.id], 20 | relationName: "reviewer", 21 | }), 22 | })); 23 | -------------------------------------------------------------------------------- /apps/cli/example/multi-files-barrel/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/multi-files-barrel"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: `${base}/schemas`, 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | entities: { 23 | roles: { 24 | provider: "supabase", 25 | exclude: ["supabase_auth_admin"], 26 | }, 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/wand-sparkles.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.com/schema.json", 3 | "tasks": { 4 | "build": { 5 | "dependsOn": ["^build"], 6 | "inputs": ["$TURBO_DEFAULT$", ".env*"], 7 | "outputs": ["dist/**", "build/**"] 8 | }, 9 | "format": { 10 | "dependsOn": ["^format"] 11 | }, 12 | "check": { 13 | "dependsOn": ["^check"] 14 | }, 15 | "check:fix": { 16 | "dependsOn": ["^check:fix"] 17 | }, 18 | "typecheck": { 19 | "dependsOn": ["^typecheck"] 20 | }, 21 | "dev": { 22 | "with": ["dev:watch"], 23 | "persistent": true, 24 | "cache": false 25 | }, 26 | "dev:watch": { 27 | "persistent": true, 28 | "cache": false 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/wand-sparkles.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /apps/cli/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/pg"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: `${base}/schema.ts`, 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | entities: { 23 | roles: { 24 | provider: "supabase", 25 | exclude: ["supabase_auth_admin"], 26 | }, 27 | }, 28 | // lab: { 29 | // projectId: "drizzle-lab-cli", 30 | // }, 31 | }); 32 | -------------------------------------------------------------------------------- /shared/ui/other/svg-icons/bug-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Fixes # 2 | 3 | # Description 4 | 5 | Please include a summary of the change and which issue is fixed, if any. Please also include relevant motivation and context. 6 | List any dependencies that are required for this change. 7 | 8 | ## Type of change 9 | 10 | Please mark relevant options with an `x` in the brackets. 11 | 12 | - [ ] Bug fix (non-breaking change which fixes an issue) 13 | - [ ] New feature (non-breaking change which adds functionality) 14 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 15 | 16 | # Reviewer checklist 17 | 18 | You have tested the changes and they are working as expected. 19 | 20 | # Screenshots (if appropriate): 21 | 22 | # Questions (if appropriate): 23 | -------------------------------------------------------------------------------- /apps/cli/example/multi-packages/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/multi-packages"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: [`${base}/**/database/schema.ts`, `${base}/**/database/relations.ts`], 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | entities: { 23 | roles: { 24 | provider: "supabase", 25 | exclude: ["supabase_auth_admin"], 26 | }, 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /apps/cli/example/multi-packages/drizzle.config.dev.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the configuration for the server-side database. 3 | */ 4 | 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | const base = "./example/multi-packages"; 8 | 9 | export default defineConfig({ 10 | dialect: "postgresql", 11 | dbCredentials: { 12 | url: process.env.ADMIN_DATABASE_URL!, 13 | }, 14 | schema: [`${base}/**/database/schema.ts`, `${base}/**/database/relations.ts`], 15 | out: `${base}/migrations`, 16 | verbose: false, 17 | schemaFilter: ["public"], 18 | casing: "snake_case", 19 | migrations: { 20 | prefix: "timestamp", 21 | }, 22 | entities: { 23 | roles: { 24 | provider: "supabase", 25 | exclude: ["supabase_auth_admin"], 26 | }, 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /apps/drizzle-run/other/svg-icons/bug-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /apps/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/remix.json", 3 | "include": [ 4 | "**/*.d.ts", 5 | "**/*.ts", 6 | "**/*.tsx", 7 | "**/.server/**/*.ts", 8 | "**/.server/**/*.tsx", 9 | "**/.client/**/*.ts", 10 | "**/.client/**/*.tsx", 11 | "../../shared/typescript-config/reset.d.ts" 12 | ], 13 | "exclude": ["node_modules"], 14 | "compilerOptions": { 15 | "allowImportingTsExtensions": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "@/*": ["./*"], 19 | "~/*": ["visualizer/*"], 20 | "@drizzle-lab/api/*/node": ["../../packages/api/src/*/index.node"], 21 | "@drizzle-lab/api/*": ["../../packages/api/src/*"], 22 | "@drizzle-lab/visualizer/*": ["../../packages/visualizer/src/*"] 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/nav-item.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from "./ui/button"; 2 | import { Icon, type IconName } from "./ui/icon"; 3 | import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip"; 4 | 5 | export function NavItem({ 6 | tooltip, 7 | icon, 8 | onClick, 9 | }: { 10 | tooltip: string; 11 | icon: IconName; 12 | onClick?: () => void; 13 | }) { 14 | return ( 15 | 16 | 17 | 20 | 21 | 22 | {tooltip} 23 | 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /apps/cli/example/multi-packages/package-relations/database/relations.ts: -------------------------------------------------------------------------------- 1 | import { relations } from "drizzle-orm"; 2 | 3 | import { posts } from "../../package-posts/database/schema"; 4 | import { users } from "../../package-users/database/schema"; 5 | 6 | export const usersRelations = relations(users, ({ many }) => ({ 7 | author: many(posts, { relationName: "author" }), 8 | reviewer: many(posts, { relationName: "reviewer" }), 9 | })); 10 | 11 | export const postsRelations = relations(posts, ({ one }) => ({ 12 | author: one(users, { 13 | fields: [posts.authorId], 14 | references: [users.id], 15 | relationName: "author", 16 | }), 17 | reviewer: one(users, { 18 | fields: [posts.reviewerId], 19 | references: [users.id], 20 | relationName: "reviewer", 21 | }), 22 | })); 23 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import * as LabelPrimitive from "@radix-ui/react-label"; 4 | import { type VariantProps, cva } from "class-variance-authority"; 5 | 6 | import { cn } from "~/utils/cn"; 7 | 8 | const labelVariants = cva("peer-disabled:opacity-70 font-medium text-sm leading-none peer-disabled:cursor-not-allowed"); 9 | 10 | const Label = React.forwardRef< 11 | React.ElementRef, 12 | React.ComponentPropsWithoutRef & VariantProps 13 | >(({ className, ...props }, ref) => ( 14 | 15 | )); 16 | Label.displayName = LabelPrimitive.Root.displayName; 17 | 18 | export { Label }; 19 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}/vscode-extension" 14 | ], 15 | "outFiles": ["${workspaceFolder}/vscode-extension/dist/**/*.js"], 16 | "preLaunchTask": "${defaultBuildTask}", 17 | "env": { 18 | "NODE_ENV": "development" 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import * as SeparatorPrimitive from "@radix-ui/react-separator"; 4 | 5 | import { cn } from "~/utils/cn"; 6 | 7 | const Separator = React.forwardRef< 8 | React.ElementRef, 9 | React.ComponentPropsWithoutRef 10 | >(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => ( 11 | 18 | )); 19 | Separator.displayName = SeparatorPrimitive.Root.displayName; 20 | 21 | export { Separator }; 22 | -------------------------------------------------------------------------------- /apps/drizzle-run/app/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { cn } from "~/utils/cn"; 4 | 5 | export interface TextareaProps extends React.TextareaHTMLAttributes {} 6 | 7 | const Textarea = React.forwardRef(({ className, ...props }, ref) => { 8 | return ( 9 |