├── .eslintignore ├── src ├── data │ ├── progress.ts │ ├── llms.ts │ └── sponsor-config.ts ├── mdx │ ├── Steps.astro │ ├── Tab.astro │ ├── Section.astro │ ├── CodeTab.astro │ ├── Drivers.mdx │ ├── get-started │ │ ├── InstallPackages.mdx │ │ ├── SetupEnv.mdx │ │ ├── sqlite │ │ │ ├── CreateTable.mdx │ │ │ ├── UpdateSchema.mdx │ │ │ ├── ConnectSQLiteCloud.mdx │ │ │ ├── ConnectLibsql.mdx │ │ │ ├── ConnectBun.mdx │ │ │ ├── ConnectTursoDatabase.mdx │ │ │ ├── QueryTurso.mdx │ │ │ ├── IntrospectSqlite.mdx │ │ │ └── QueryTursoUpdated.mdx │ │ ├── mssql │ │ │ ├── CreateTable.mdx │ │ │ ├── UpdateSchema.mdx │ │ │ ├── ConnectMSSQL.mdx │ │ │ └── IntrospectMSSQL.mdx │ │ ├── postgresql │ │ │ ├── ConnectVercel.mdx │ │ │ ├── CreateTable.mdx │ │ │ ├── ConnectPgLite.mdx │ │ │ ├── ConnectNeon.mdx │ │ │ ├── UpdateSchema.mdx │ │ │ ├── ConnectXata.mdx │ │ │ ├── ConnectBun.mdx │ │ │ ├── ConnectPostgreSQL.mdx │ │ │ ├── ConnectSupabase.mdx │ │ │ ├── ConnectNile.mdx │ │ │ └── IntrospectPostgreSQL.mdx │ │ ├── mysql │ │ │ ├── CreateTable.mdx │ │ │ ├── ConnectTiDB.mdx │ │ │ ├── ConnectPlanetScale.mdx │ │ │ ├── UpdateSchema.mdx │ │ │ ├── QueryPlanetScale.mdx │ │ │ └── ConnectMySQL.mdx │ │ ├── FileStructure.mdx │ │ ├── singlestore │ │ │ ├── CreateSingleStoreTable.mdx │ │ │ ├── UpdateSchema.mdx │ │ │ ├── ConnectSingleStore.mdx │ │ │ └── IntrospectSingleStore.mdx │ │ ├── cockroach │ │ │ ├── CreateTable.mdx │ │ │ ├── UpdateSchema.mdx │ │ │ ├── ConnectCockroach.mdx │ │ │ └── IntrospectCockroach.mdx │ │ ├── TransferCode.mdx │ │ ├── SetupConfig.mdx │ │ ├── RunFile.mdx │ │ ├── ApplyChanges.mdx │ │ ├── QueryDatabaseUpdated.mdx │ │ └── QueryDatabase.mdx │ ├── Dialects.mdx │ ├── Flex.astro │ ├── RowCodeWrap.astro │ ├── CodeWithProps.astro │ ├── TableWrapper.astro │ ├── Link.astro │ ├── Tag.astro │ ├── Cards.astro │ ├── IsSupportedChip.astro │ ├── WhatsNextMSSQL.astro │ ├── WhatsNextPostgres.astro │ ├── $count.mdx │ ├── DriversExamples.mdx │ ├── LibsqlTabs.mdx │ ├── LibsqlTable.mdx │ ├── CodeTabs.astro │ └── Tabs.astro ├── content │ ├── docs │ │ ├── seed-limitations.mdx │ │ ├── guides.mdx │ │ ├── tutorials.mdx │ │ ├── latest-releases.mdx │ │ ├── extensions │ │ │ ├── _meta.json │ │ │ ├── mysql.mdx │ │ │ ├── sqlite.mdx │ │ │ └── singlestore.mdx │ │ ├── column-types │ │ │ └── _meta.json │ │ ├── connect-aws-data-api-mysql.mdx │ │ ├── latest-releases │ │ │ ├── drizzle-orm-v0314.mdx │ │ │ ├── drizzle-orm-v0281.mdx │ │ │ ├── drizzle-kit-v0232.mdx │ │ │ ├── drizzle-orm-v0322.mdx │ │ │ ├── drizzle-orm-v0293.mdx │ │ │ ├── drizzle-orm-v0312.mdx │ │ │ ├── drizzle-orm-v0321.mdx │ │ │ ├── drizzle-orm-v0284.mdx │ │ │ ├── drizzle-orm-v0313.mdx │ │ │ ├── drizzle-orm-v0307.mdx │ │ │ ├── drizzle-orm-v0301.mdx │ │ │ ├── drizzle-orm-v03010.mdx │ │ │ ├── drizzle-orm-v0303.mdx │ │ │ ├── drizzle-orm-v0302.mdx │ │ │ ├── drizzle-orm-v0282.mdx │ │ │ ├── drizzle-orm-v0306.mdx │ │ │ ├── drizzle-orm-v0285.mdx │ │ │ ├── drizzle-orm-v0309.mdx │ │ │ ├── drizzle-orm-v0305.mdx │ │ │ └── drizzle-orm-v0304.mdx │ │ ├── get-started.mdx │ │ ├── kit-migrations-for-teams.mdx │ │ ├── gotchas.mdx │ │ ├── get-started │ │ │ ├── expo-existing.mdx │ │ │ └── op-sqlite-existing.mdx │ │ ├── query-utils.mdx │ │ ├── kit-seed-data.mdx │ │ ├── connect-react-native-sqlite.mdx │ │ ├── kit-web-mobile.mdx │ │ ├── perf-serverless.mdx │ │ ├── guides │ │ │ ├── toggling-a-boolean-field.mdx │ │ │ ├── decrementing-a-value.mdx │ │ │ ├── incrementing-a-value.mdx │ │ │ └── _map.json │ │ ├── connect-bun-sql.mdx │ │ └── connect-turso-database.mdx │ └── announcements │ │ ├── 0001.md │ │ └── 0002.md ├── env.d.ts ├── assets │ ├── gifs │ │ ├── drop.gif │ │ ├── up_mysql.gif │ │ └── introspect_mysql.gif │ ├── images │ │ ├── mssql.png │ │ ├── bestofjs.jpg │ │ ├── team │ │ │ ├── mike.jpg │ │ │ ├── reka.png │ │ │ ├── vlad.jpg │ │ │ ├── artem.jpg │ │ │ ├── blokh.png │ │ │ ├── homenko.jpg │ │ │ ├── roman.jpg │ │ │ ├── sherman.png │ │ │ ├── vitalii.jpg │ │ │ └── bloberenober.png │ │ ├── drizzle31kb.jpg │ │ ├── how-it-works.png │ │ ├── landing │ │ │ ├── Back.png │ │ │ ├── DB.png │ │ │ ├── Love.png │ │ │ ├── Front.png │ │ │ ├── WithDB.png │ │ │ ├── BackDark.png │ │ │ ├── CrossOut.png │ │ │ ├── FrontDark.png │ │ │ ├── WithDBDark.png │ │ │ └── WoodBorder.webp │ │ ├── not_found.webp │ │ ├── tweets │ │ │ ├── lroal.png │ │ │ ├── thdxr.jpg │ │ │ ├── aokijs.jpg │ │ │ ├── t3dotgg.jpg │ │ │ ├── EddyVinckk.jpg │ │ │ ├── JacobWolf.jpg │ │ │ ├── adamdotdev.jpg │ │ │ ├── brodaNoel.jpg │ │ │ ├── chribjel.jpg │ │ │ ├── hisbvdis.jpg │ │ │ ├── imfelquis.jpg │ │ │ ├── raynirola.jpg │ │ │ ├── saltyAom.jpg │ │ │ ├── silvenon.jpg │ │ │ ├── tslamoon1.jpg │ │ │ ├── FredKSchott.jpg │ │ │ ├── anthonysheww.jpg │ │ │ ├── jacobmparis.jpg │ │ │ ├── aarondfrancis.jpg │ │ │ ├── chribjelTweet.png │ │ │ ├── james_r_perkins.jpg │ │ │ ├── saltyAomTweet.jpg │ │ │ ├── silvenonTweet.webp │ │ │ ├── spacesexdragon.jpg │ │ │ ├── jamesrperkinsTweet.png │ │ │ └── spacesexdragonTweet.jpg │ │ ├── with-money.webp │ │ ├── drizzle-studio.jpg │ │ ├── without-money.webp │ │ ├── benchmark-result.webp │ │ ├── drizzle-studio.jpeg │ │ ├── LiveOnTheEdgeDark.webp │ │ ├── announcements │ │ │ ├── logo.jpg │ │ │ ├── 0001-01.jpg │ │ │ ├── 0002-01.jpg │ │ │ └── logo-dark.jpg │ │ ├── contributors │ │ │ ├── rphlmr.png │ │ │ ├── angelelz.png │ │ │ ├── mario564.png │ │ │ └── intelligently.png │ │ ├── houston_astronaut.webp │ │ ├── mysql-db-structure.png │ │ ├── sqlite-db-structure.png │ │ ├── ConnectEverywhereDark.webp │ │ ├── drizzle-studio-dark.webp │ │ ├── drizzle-studio-light.webp │ │ └── postgresql-db-structure.png │ ├── fonts │ │ ├── Menlo-Regular.woff │ │ └── FirstTimeWriting.ttf │ └── icons │ │ ├── ArrowRight.tsx │ │ ├── TypeScriptIcon.astro │ │ ├── JavaScriptIcon.astro │ │ ├── PrismaIcon.tsx │ │ ├── CrossOutIcon.astro │ │ ├── DocsIcon.astro │ │ ├── DrizzleLogo.tsx │ │ └── OptionsIcon.tsx ├── files.d.ts ├── ui │ └── components │ │ ├── landing │ │ └── benchmark │ │ │ ├── constants.ts │ │ │ ├── utils │ │ │ ├── fixedHelper.ts │ │ │ ├── formatMs.ts │ │ │ ├── roundToThousand.ts │ │ │ ├── getSubArray.ts │ │ │ ├── formatNumber.ts │ │ │ ├── getDemoBenchmarkData.ts │ │ │ └── Logo.tsx │ │ │ ├── components │ │ │ ├── Timer │ │ │ │ ├── Timer.module.css │ │ │ │ └── Timer.tsx │ │ │ ├── SpeedSelector │ │ │ │ ├── SpeedSelector.module.css │ │ │ │ └── SpeedSelector.tsx │ │ │ ├── BenchmarkConfig │ │ │ │ ├── BenchmarkConfig.module.css │ │ │ │ └── BenchmarkConfig.tsx │ │ │ ├── JoinsSelector │ │ │ │ ├── JoinsSelector.module.css │ │ │ │ └── JoinsSelector.tsx │ │ │ └── RuntimeSelector │ │ │ │ ├── RuntimeSelector.module.css │ │ │ │ └── NodeIcon.tsx │ │ │ ├── MdxBenchmark.module.css │ │ │ ├── MdxBenchmark.tsx │ │ │ └── types.ts │ │ ├── EndOfContent.astro │ │ ├── CustomHeader.astro │ │ ├── DialectTab.astro │ │ ├── Banner.astro │ │ └── LandingNavbar.astro └── pages │ ├── docs │ ├── tutorials │ │ └── [...slug].astro │ └── migrate │ │ └── [...slug].astro │ ├── llms-full.txt.ts │ ├── roadmap.astro │ └── [...slug].astro ├── public ├── favicon.ico ├── robots.txt ├── svg │ ├── lagon.png │ ├── lagon.webp │ ├── opsqlite.png │ ├── mssql-dark.png │ ├── mssql-light.png │ ├── cockroachdb-dark.png │ ├── cockroachdb-light.png │ ├── vercel-dark.svg │ ├── vercel-light.svg │ ├── heart.svg │ ├── vercel.svg │ ├── react-native.svg │ ├── lokalise-dark.svg │ ├── lokalise-light.svg │ ├── cloudflare.svg │ ├── warp-dark.svg │ ├── warp-light.svg │ ├── tidb.svg │ ├── database.svg │ ├── expo.svg │ ├── planetscale.svg │ ├── prisma-dark.svg │ ├── prisma.svg │ ├── sentry-dark.svg │ ├── sentry-light.svg │ ├── gel_dark.svg │ ├── gel_light.svg │ ├── gel_transparent.svg │ ├── quote.svg │ ├── gibsonai-dark.svg │ ├── gibsonai-light.svg │ ├── new-turso.svg │ ├── edb_logo_small.svg │ ├── new-turso-light.svg │ ├── drizzle-dark.svg │ ├── supabase.svg │ ├── drizzle.svg │ ├── nuxt-green.svg │ ├── gel_logo_letters.svg │ ├── clerk-light.svg │ ├── clerk-dark.svg │ ├── payload-dark.svg │ ├── payload.svg │ ├── upstash-icon-dark-bg.svg │ ├── upstash-icon-white-bg.svg │ ├── praha-dark.svg │ └── praha-light.svg ├── images │ ├── dbos.png │ ├── deco.png │ ├── hydra.png │ ├── kinde.jpeg │ ├── motion.png │ ├── tembo.png │ ├── unkey.jpeg │ ├── mooncake.png │ ├── snaplet.png │ ├── sticker.webp │ ├── zolplay.jpeg │ ├── hydra-black.png │ ├── solidhour.png │ ├── hydra-orange.png │ └── mooncake-white.png ├── drizzle-studio.jpg ├── preferred.css └── inkeep-styles.css ├── vitest.config.ts ├── .prettierrc.mjs ├── postcss.config.cjs ├── .gitignore ├── tsconfig.json ├── README.md └── .eslintrc.json /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /src/data/progress.ts: -------------------------------------------------------------------------------- 1 | export default 94; 2 | -------------------------------------------------------------------------------- /src/mdx/Steps.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /src/mdx/Tab.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /src/content/docs/seed-limitations.mdx: -------------------------------------------------------------------------------- 1 | // type limitations for third param -------------------------------------------------------------------------------- /src/mdx/Section.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /src/mdx/CodeTab.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /src/content/docs/guides.mdx: -------------------------------------------------------------------------------- 1 | import Guides from "@components/Guides.astro"; 2 | 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | 4 | Sitemap: https://orm.drizzle.team/sitemap-index.xml -------------------------------------------------------------------------------- /public/svg/lagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/lagon.png -------------------------------------------------------------------------------- /public/svg/lagon.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/lagon.webp -------------------------------------------------------------------------------- /src/content/docs/tutorials.mdx: -------------------------------------------------------------------------------- 1 | import Tutorials from "@components/Tutorials.astro"; 2 | 3 | -------------------------------------------------------------------------------- /src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /public/images/dbos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/dbos.png -------------------------------------------------------------------------------- /public/images/deco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/deco.png -------------------------------------------------------------------------------- /public/images/hydra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/hydra.png -------------------------------------------------------------------------------- /public/images/kinde.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/kinde.jpeg -------------------------------------------------------------------------------- /public/images/motion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/motion.png -------------------------------------------------------------------------------- /public/images/tembo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/tembo.png -------------------------------------------------------------------------------- /public/images/unkey.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/unkey.jpeg -------------------------------------------------------------------------------- /public/svg/opsqlite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/opsqlite.png -------------------------------------------------------------------------------- /src/assets/gifs/drop.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/gifs/drop.gif -------------------------------------------------------------------------------- /public/drizzle-studio.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/drizzle-studio.jpg -------------------------------------------------------------------------------- /public/images/mooncake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/mooncake.png -------------------------------------------------------------------------------- /public/images/snaplet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/snaplet.png -------------------------------------------------------------------------------- /public/images/sticker.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/sticker.webp -------------------------------------------------------------------------------- /public/images/zolplay.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/zolplay.jpeg -------------------------------------------------------------------------------- /public/svg/mssql-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/mssql-dark.png -------------------------------------------------------------------------------- /public/svg/mssql-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/mssql-light.png -------------------------------------------------------------------------------- /public/images/hydra-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/hydra-black.png -------------------------------------------------------------------------------- /public/images/solidhour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/solidhour.png -------------------------------------------------------------------------------- /src/assets/gifs/up_mysql.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/gifs/up_mysql.gif -------------------------------------------------------------------------------- /src/assets/images/mssql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/mssql.png -------------------------------------------------------------------------------- /public/images/hydra-orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/hydra-orange.png -------------------------------------------------------------------------------- /public/svg/cockroachdb-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/cockroachdb-dark.png -------------------------------------------------------------------------------- /src/assets/images/bestofjs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/bestofjs.jpg -------------------------------------------------------------------------------- /src/assets/images/team/mike.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/mike.jpg -------------------------------------------------------------------------------- /src/assets/images/team/reka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/reka.png -------------------------------------------------------------------------------- /src/assets/images/team/vlad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/vlad.jpg -------------------------------------------------------------------------------- /src/content/docs/latest-releases.mdx: -------------------------------------------------------------------------------- 1 | import LatestReleases from "@components/LatestReleases.astro"; 2 | 3 | -------------------------------------------------------------------------------- /public/images/mooncake-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/images/mooncake-white.png -------------------------------------------------------------------------------- /public/svg/cockroachdb-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/public/svg/cockroachdb-light.png -------------------------------------------------------------------------------- /src/assets/images/drizzle31kb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/drizzle31kb.jpg -------------------------------------------------------------------------------- /src/assets/images/how-it-works.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/how-it-works.png -------------------------------------------------------------------------------- /src/assets/images/landing/Back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/Back.png -------------------------------------------------------------------------------- /src/assets/images/landing/DB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/DB.png -------------------------------------------------------------------------------- /src/assets/images/landing/Love.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/Love.png -------------------------------------------------------------------------------- /src/assets/images/not_found.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/not_found.webp -------------------------------------------------------------------------------- /src/assets/images/team/artem.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/artem.jpg -------------------------------------------------------------------------------- /src/assets/images/team/blokh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/blokh.png -------------------------------------------------------------------------------- /src/assets/images/team/homenko.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/homenko.jpg -------------------------------------------------------------------------------- /src/assets/images/team/roman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/roman.jpg -------------------------------------------------------------------------------- /src/assets/images/team/sherman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/sherman.png -------------------------------------------------------------------------------- /src/assets/images/team/vitalii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/vitalii.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/lroal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/lroal.png -------------------------------------------------------------------------------- /src/assets/images/tweets/thdxr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/thdxr.jpg -------------------------------------------------------------------------------- /src/assets/images/with-money.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/with-money.webp -------------------------------------------------------------------------------- /src/assets/fonts/Menlo-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/fonts/Menlo-Regular.woff -------------------------------------------------------------------------------- /src/assets/gifs/introspect_mysql.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/gifs/introspect_mysql.gif -------------------------------------------------------------------------------- /src/assets/images/drizzle-studio.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/drizzle-studio.jpg -------------------------------------------------------------------------------- /src/assets/images/landing/Front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/Front.png -------------------------------------------------------------------------------- /src/assets/images/landing/WithDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/WithDB.png -------------------------------------------------------------------------------- /src/assets/images/tweets/aokijs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/aokijs.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/t3dotgg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/t3dotgg.jpg -------------------------------------------------------------------------------- /src/assets/images/without-money.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/without-money.webp -------------------------------------------------------------------------------- /src/assets/fonts/FirstTimeWriting.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/fonts/FirstTimeWriting.ttf -------------------------------------------------------------------------------- /src/assets/images/benchmark-result.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/benchmark-result.webp -------------------------------------------------------------------------------- /src/assets/images/drizzle-studio.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/drizzle-studio.jpeg -------------------------------------------------------------------------------- /src/assets/images/landing/BackDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/BackDark.png -------------------------------------------------------------------------------- /src/assets/images/landing/CrossOut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/CrossOut.png -------------------------------------------------------------------------------- /src/assets/images/landing/FrontDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/FrontDark.png -------------------------------------------------------------------------------- /src/assets/images/team/bloberenober.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/team/bloberenober.png -------------------------------------------------------------------------------- /src/assets/images/tweets/EddyVinckk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/EddyVinckk.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/JacobWolf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/JacobWolf.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/adamdotdev.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/adamdotdev.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/brodaNoel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/brodaNoel.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/chribjel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/chribjel.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/hisbvdis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/hisbvdis.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/imfelquis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/imfelquis.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/raynirola.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/raynirola.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/saltyAom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/saltyAom.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/silvenon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/silvenon.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/tslamoon1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/tslamoon1.jpg -------------------------------------------------------------------------------- /src/files.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.yaml" { 2 | const value: Months; 3 | export default value; 4 | } 5 | 6 | declare module "*.module.css"; -------------------------------------------------------------------------------- /src/assets/images/LiveOnTheEdgeDark.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/LiveOnTheEdgeDark.webp -------------------------------------------------------------------------------- /src/assets/images/announcements/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/announcements/logo.jpg -------------------------------------------------------------------------------- /src/assets/images/contributors/rphlmr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/contributors/rphlmr.png -------------------------------------------------------------------------------- /src/assets/images/houston_astronaut.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/houston_astronaut.webp -------------------------------------------------------------------------------- /src/assets/images/landing/WithDBDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/WithDBDark.png -------------------------------------------------------------------------------- /src/assets/images/landing/WoodBorder.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/landing/WoodBorder.webp -------------------------------------------------------------------------------- /src/assets/images/mysql-db-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/mysql-db-structure.png -------------------------------------------------------------------------------- /src/assets/images/sqlite-db-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/sqlite-db-structure.png -------------------------------------------------------------------------------- /src/assets/images/tweets/FredKSchott.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/FredKSchott.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/anthonysheww.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/anthonysheww.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/jacobmparis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/jacobmparis.jpg -------------------------------------------------------------------------------- /src/assets/images/ConnectEverywhereDark.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/ConnectEverywhereDark.webp -------------------------------------------------------------------------------- /src/assets/images/announcements/0001-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/announcements/0001-01.jpg -------------------------------------------------------------------------------- /src/assets/images/announcements/0002-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/announcements/0002-01.jpg -------------------------------------------------------------------------------- /src/assets/images/contributors/angelelz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/contributors/angelelz.png -------------------------------------------------------------------------------- /src/assets/images/contributors/mario564.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/contributors/mario564.png -------------------------------------------------------------------------------- /src/assets/images/drizzle-studio-dark.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/drizzle-studio-dark.webp -------------------------------------------------------------------------------- /src/assets/images/drizzle-studio-light.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/drizzle-studio-light.webp -------------------------------------------------------------------------------- /src/assets/images/tweets/aarondfrancis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/aarondfrancis.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/chribjelTweet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/chribjelTweet.png -------------------------------------------------------------------------------- /src/assets/images/tweets/james_r_perkins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/james_r_perkins.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/saltyAomTweet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/saltyAomTweet.jpg -------------------------------------------------------------------------------- /src/assets/images/tweets/silvenonTweet.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/silvenonTweet.webp -------------------------------------------------------------------------------- /src/assets/images/tweets/spacesexdragon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/spacesexdragon.jpg -------------------------------------------------------------------------------- /src/assets/images/announcements/logo-dark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/announcements/logo-dark.jpg -------------------------------------------------------------------------------- /src/assets/images/postgresql-db-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/postgresql-db-structure.png -------------------------------------------------------------------------------- /src/assets/images/contributors/intelligently.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/contributors/intelligently.png -------------------------------------------------------------------------------- /src/assets/images/tweets/jamesrperkinsTweet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/jamesrperkinsTweet.png -------------------------------------------------------------------------------- /src/assets/images/tweets/spacesexdragonTweet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drizzle-team/drizzle-orm-docs/HEAD/src/assets/images/tweets/spacesexdragonTweet.jpg -------------------------------------------------------------------------------- /src/mdx/Drivers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | drivers: ['aws-data-api', 'd1-http', 'pglight'] 3 | --- 4 | 5 | {frontmatter.drivers.map((driver) => <>{driver} )} -------------------------------------------------------------------------------- /src/content/docs/extensions/_meta.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["pg", "PostgreSQL"], 3 | ["mysql", "MySQL"], 4 | ["sqlite", "SQLite"], 5 | ["singlestore", "SingleStore"] 6 | ] 7 | -------------------------------------------------------------------------------- /src/mdx/get-started/InstallPackages.mdx: -------------------------------------------------------------------------------- 1 | import Npm from '@mdx/Npm.astro'; 2 | 3 | 4 | drizzle-orm {props.lib} dotenv 5 | -D drizzle-kit tsx{props.devlib} 6 | 7 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { defineConfig } from 'vitest/config'; 3 | 4 | export default defineConfig({ 5 | test: { 6 | environment: 'happy-dom', 7 | }, 8 | }); -------------------------------------------------------------------------------- /public/svg/vercel-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /public/svg/vercel-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/constants.ts: -------------------------------------------------------------------------------- 1 | export const DELAY = 1000; // ms 2 | 3 | // SIZES 4 | 5 | export const SVGViewBoxHeight = 170; 6 | export const SVGViewBoxWidth = 900; 7 | -------------------------------------------------------------------------------- /src/mdx/Dialects.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | dialects: ['postgresql', 'mysql', 'sqlite', 'turso', 'singlestore', 'mssql', 'cockroachdb'] 3 | --- 4 | 5 | {frontmatter.dialects.map(dialect => <>{dialect} )} -------------------------------------------------------------------------------- /src/content/docs/column-types/_meta.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["pg", "PostgreSQL"], 3 | ["mysql", "MySQL"], 4 | ["sqlite", "SQLite"], 5 | ["singlestore", "SingleStore"], 6 | ["mssql", "MSSQL"], 7 | ["cockroach", "CockroachDB"] 8 | ] -------------------------------------------------------------------------------- /.prettierrc.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: ['prettier-plugin-astro'], 3 | overrides: [ 4 | { 5 | files: '*.astro', 6 | options: { 7 | parser: 'astro', 8 | }, 9 | }, 10 | ], 11 | }; -------------------------------------------------------------------------------- /src/content/docs/connect-aws-data-api-mysql.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | 3 | 4 | # Drizzle \<\> AWS Data API MySQL 5 | 6 | 7 | Currently AWS Data API for MySQL is not implemented in Drizzle ORM 8 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0314.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.31.4 release 3 | pubDate: 2024-07-08 4 | description: Mark prisma clients package as optional 5 | --- 6 | 7 | - Mark prisma clients package as optional - thanks @Cherry -------------------------------------------------------------------------------- /src/mdx/Flex.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | -------------------------------------------------------------------------------- /src/ui/components/EndOfContent.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 | 11 | -------------------------------------------------------------------------------- /src/content/docs/extensions/mysql.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: MySQL extensions 3 | --- 4 | 5 | import Callout from '@mdx/Callout.astro'; 6 | 7 | 8 | Currently, there are no MySQL extensions natively supported by Drizzle. Once those are added, we will have them here! 9 | -------------------------------------------------------------------------------- /src/content/docs/extensions/sqlite.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: SQLite extensions 3 | --- 4 | 5 | import Callout from '@mdx/Callout.astro'; 6 | 7 | 8 | Currently, there are no SQLite extensions natively supported by Drizzle. Once those are added, we will have them here! 9 | -------------------------------------------------------------------------------- /postcss.config.cjs: -------------------------------------------------------------------------------- 1 | const autoprefixer = require("autoprefixer"); 2 | const cssnano = require("cssnano"); 3 | 4 | const config = { 5 | plugins: [ 6 | autoprefixer(), 7 | cssnano({ 8 | preset: "default", 9 | }), 10 | ], 11 | }; 12 | 13 | module.exports = config; 14 | -------------------------------------------------------------------------------- /src/content/docs/extensions/singlestore.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: SingleStore extensions 3 | --- 4 | 5 | import Callout from '@mdx/Callout.astro'; 6 | 7 | 8 | Currently, there are no SingleStore extensions natively supported by Drizzle. Once those are added, we will have them here! 9 | -------------------------------------------------------------------------------- /src/mdx/RowCodeWrap.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | -------------------------------------------------------------------------------- /src/content/docs/get-started.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | import CodeTabs from '@mdx/CodeTabs.astro'; 3 | import YoutubeCards from '@mdx/YoutubeCards.astro'; 4 | import GetStartedLinks from '@mdx/GetStartedLinks/index.astro'; 5 | 6 | # Get started with Drizzle 7 | -------------------------------------------------------------------------------- /src/mdx/CodeWithProps.astro: -------------------------------------------------------------------------------- 1 | --- 2 | const props = Astro.props; 3 | let html = await Astro.slots.render('default'); 4 | 5 | Object.entries(props).forEach(([key, value]) => { 6 | html = html.replaceAll(`$${key}$`, value); 7 | }) 8 | 9 | --- 10 |
11 | 12 |
-------------------------------------------------------------------------------- /src/mdx/get-started/SetupEnv.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | Create a `.env` file in the root of your project and add your database connection variable: 4 | 5 | 6 | ```plaintext copy 7 | $env_variable$= 8 | ``` 9 | -------------------------------------------------------------------------------- /public/preferred.css: -------------------------------------------------------------------------------- 1 | @media (prefers-color-scheme: light) { 2 | body { 3 | background-color: #FFFFFF; 4 | } 5 | } 6 | 7 | @media (prefers-color-scheme: dark) { 8 | body { 9 | background-color: #111111; 10 | } 11 | } 12 | 13 | 14 | html::view-transition-group(*) { 15 | animation-duration: 0s; 16 | } 17 | -------------------------------------------------------------------------------- /src/content/docs/kit-migrations-for-teams.mdx: -------------------------------------------------------------------------------- 1 | # Drizzle migrations for teams 2 | 3 | This section will be updated right after our release of the next version of migrations folder structure. 4 | You can read an extended [github discussion](https://github.com/drizzle-team/drizzle-orm/discussions/2832) and subscribe to the updates! 5 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/fixedHelper.ts: -------------------------------------------------------------------------------- 1 | const fixedHelper = (number: number, precision = 0) => { 2 | if (Number.isInteger(number)) { 3 | return number; 4 | } 5 | const multiplier = 10 ** precision; 6 | return Math.round(number * multiplier) / multiplier; 7 | }; 8 | 9 | export default fixedHelper; 10 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/formatMs.ts: -------------------------------------------------------------------------------- 1 | import fixedHelper from "./fixedHelper"; 2 | 3 | const formatMs = (ms: number) => { 4 | if (ms < 100) return `${ms.toFixed(1)}ms`; 5 | if (ms < 1000) return `${fixedHelper(ms)}ms`; 6 | return `${fixedHelper(ms / 1000, 2)}s`; 7 | }; 8 | 9 | export default formatMs; 10 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/roundToThousand.ts: -------------------------------------------------------------------------------- 1 | const roundToThousand = (num: number): string => { 2 | if (num < 1000) { 3 | return num.toFixed(); 4 | } 5 | if (num < 1000000) { 6 | return `${(num / 1000).toFixed(1)}k`; 7 | } 8 | return `${(num / 1000000).toFixed(2)}M`; 9 | }; 10 | 11 | export default roundToThousand; 12 | -------------------------------------------------------------------------------- /src/data/llms.ts: -------------------------------------------------------------------------------- 1 | export const title = 'Drizzle'; 2 | export const description = 'Drizzle is a modern TypeScript ORM developers wanna use in their next project. It is lightweight at only ~7.4kb minified+gzipped, and it\'s tree shakeable with exactly 0 dependencies. It supports every PostgreSQL, MySQL, SQLite and SingleStore database and is serverless-ready by design.'; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | dist/ 3 | 4 | # generated types 5 | .astro/ 6 | 7 | # dependencies 8 | node_modules/ 9 | 10 | # logs 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # environment variables 17 | .env 18 | .env.production 19 | 20 | # macOS-specific files 21 | .DS_Store 22 | 23 | .vscode 24 | 25 | package-lock.json 26 | -------------------------------------------------------------------------------- /public/svg/heart.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/content/docs/gotchas.mdx: -------------------------------------------------------------------------------- 1 | import CodeTab from "@mdx/CodeTab.astro"; 2 | import CodeTabs from "@mdx/CodeTabs.astro"; 3 | import Section from "@mdx/Section.astro"; 4 | import Tab from "@mdx/Tab.astro"; 5 | import Tabs from "@mdx/Tabs.astro"; 6 | import Callout from "@mdx/Callout.astro"; 7 | 8 | # Drizzle gotchas 9 | 10 | This will be a library of `gotchas` with Drizzle use cases -------------------------------------------------------------------------------- /public/svg/vercel.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | -------------------------------------------------------------------------------- /src/content/docs/get-started/expo-existing.mdx: -------------------------------------------------------------------------------- 1 | import Breadcrumbs from '@mdx/Breadcrumbs.astro'; 2 | 3 | 4 | 5 | # Get Started with Drizzle and Expo in existing project 6 | 7 | We don't have a proper guide for getting started with Expo in an existing project, and we believe that 8 | all the information from this [getting started guide](/docs/get-started/expo-new) should be sufficient -------------------------------------------------------------------------------- /src/content/docs/query-utils.mdx: -------------------------------------------------------------------------------- 1 | import Tab from '@mdx/Tab.astro'; 2 | import Tabs from '@mdx/Tabs.astro'; 3 | import Callout from '@mdx/Callout.astro'; 4 | import Section from '@mdx/Section.astro'; 5 | import IsSupportedChipGroup from '@mdx/IsSupportedChipGroup.astro'; 6 | import $count from '@mdx/$count.mdx'; 7 | 8 | # Drizzle query utils 9 | 10 | ### $count 11 | <$count/> 12 | 13 | -------------------------------------------------------------------------------- /src/mdx/TableWrapper.astro: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 19 | -------------------------------------------------------------------------------- /src/content/announcements/0001.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2024-05-03 16:00:00 3 | --- 4 | **Drizzle to GraphQL 🎉** 5 |
6 |
7 | You can now convert Drizzle Schema to GraphQL schema with just one line of code and yes, it's fully customisable! 8 |
9 |
10 | 11 | Go give it a try - [driz.link/graphql](https://driz.link/graphql) 🚀 12 | ![alt text](@/assets/images/announcements/0001-01.jpg) -------------------------------------------------------------------------------- /src/content/docs/get-started/op-sqlite-existing.mdx: -------------------------------------------------------------------------------- 1 | import Breadcrumbs from '@mdx/Breadcrumbs.astro'; 2 | 3 | 4 | 5 | # Get Started with Drizzle and OP-SQLite in existing project 6 | 7 | We don't have a proper guide for getting started with OP-SQLite in an existing project, and we believe that 8 | all the information from this [getting started guide](/docs/get-started/op-sqlite-new) should be sufficient -------------------------------------------------------------------------------- /src/mdx/Link.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { isAbsoluteUrl } from "@/utils"; 3 | 4 | interface Props { 5 | href: string; 6 | class?: string; 7 | } 8 | 9 | const { href, class: className } = Astro.props; 10 | const isAbsolute = isAbsoluteUrl(href); 11 | --- 12 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0281.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.28.1 release 3 | pubDate: 2023-08-07 4 | description: Fixed Postgres array-related issues introduced by 0.28.0. 5 | --- 6 | 7 | ## Fixes 8 | 9 | - Fixed Postgres array-related issues introduced by 0.28.0 ([#983](https://github.com/drizzle-team/drizzle-orm/issues/983), [#992](https://github.com/drizzle-team/drizzle-orm/issues/992)) 10 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/getSubArray.ts: -------------------------------------------------------------------------------- 1 | import { type IData } from "../types"; 2 | 3 | const getSubArray = (arr: IData[], index: number, maxLength: number) => { 4 | if (index < 0 || index >= arr.length || maxLength <= 0) { 5 | return []; 6 | } 7 | const startIndex = Math.max(0, index - maxLength + 1); 8 | return arr.slice(startIndex, index + 1); 9 | }; 10 | 11 | export default getSubArray; 12 | -------------------------------------------------------------------------------- /public/svg/react-native.svg: -------------------------------------------------------------------------------- 1 | 2 | React Logo 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-kit-v0232.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Drizzle Kit v0.23.2 release 3 | pubDate: 2024-08-05 4 | description: Bug fixes 5 | --- 6 | 7 | - Fixed a bug in PostgreSQL with push and introspect where the `schemaFilter` object was passed. It was detecting enums even in schemas that were not defined in the schemaFilter. 8 | - Fixed the `drizzle-kit up` command to work as expected, starting from the sequences release. -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0322.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.32.2 release 3 | pubDate: 2024-08-05 4 | description: Bug fixes 5 | --- 6 | 7 | - Fix AWS Data API type hints bugs in RQB 8 | - Fix set transactions in MySQL bug 9 | - Add forwaring dependencies within useLiveQuery, fixes [#2651](https://github.com/drizzle-team/drizzle-orm/issues/2651) 10 | - Export additional types from SQLite package, like `AnySQLiteUpdate` -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/Timer/Timer.module.css: -------------------------------------------------------------------------------- 1 | html[class~=dark] .wrap { 2 | color: #f0f0f0; 3 | } 4 | 5 | .wrap { 6 | color: #222222; 7 | display: flex; 8 | align-items: center; 9 | font-family: 10 | ui-monospace, 11 | SFMono-Regular, 12 | Menlo, 13 | Monaco, 14 | Consolas, 15 | Liberation Mono, 16 | Courier New, 17 | monospace; 18 | font-size: 14px; 19 | height: 20px; 20 | } -------------------------------------------------------------------------------- /public/svg/lokalise-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /public/svg/lokalise-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /public/svg/cloudflare.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/svg/warp-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /public/svg/warp-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0293.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.29.3 release 3 | pubDate: 2024-01-02 4 | description: Fixed expo peer dependencies. 5 | --- 6 | 7 | ## Fixes: 8 | 9 | - Make expo peer dependencies optional ([#1714](https://github.com/drizzle-team/drizzle-orm/pull/1714)) 10 | 11 | For more info you can check [Expo docs](https://expo.dev/) and [Get started with Expo SQLite and Drizzle](/docs/get-started-sqlite#expo-sqlite). 12 | -------------------------------------------------------------------------------- /public/svg/tidb.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/icons/ArrowRight.tsx: -------------------------------------------------------------------------------- 1 | const ArrowRight = () => ( 2 | 13 | 14 | 15 | 16 | ); 17 | 18 | export default ArrowRight; 19 | -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/CreateTable.mdx: -------------------------------------------------------------------------------- 1 | Create a `schema.ts` file in the `src/db` directory and declare your table: 2 | 3 | ```typescript copy filename="src/db/schema.ts" 4 | import { int, sqliteTable, text } from "drizzle-orm/sqlite-core"; 5 | 6 | export const usersTable = sqliteTable("users_table", { 7 | id: int().primaryKey({ autoIncrement: true }), 8 | name: text().notNull(), 9 | age: int().notNull(), 10 | email: text().notNull().unique(), 11 | }); 12 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/mssql/CreateTable.mdx: -------------------------------------------------------------------------------- 1 | Create a `schema.ts` file in the `src/db` directory and declare your table: 2 | 3 | ```typescript copy filename="src/db/schema.ts" 4 | import { int, mssqlTable, varchar } from "drizzle-orm/mssql-core"; 5 | 6 | export const usersTable = mssqlTable("users", { 7 | id: int().primaryKey(), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: int().notNull(), 10 | email: varchar({ length: 255 }).notNull().unique(), 11 | }); 12 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectVercel.mdx: -------------------------------------------------------------------------------- 1 | Create a `index.ts` file in the `src` directory and initialize the connection: 2 | 3 | ```typescript copy 4 | import { drizzle } from 'drizzle-orm/vercel-postgres'; 5 | 6 | const db = drizzle(); 7 | ``` 8 | 9 | If you need to provide your existing driver: 10 | 11 | ```typescript copy 12 | import { sql } from '@vercel/postgres'; 13 | import { drizzle } from 'drizzle-orm/vercel-postgres'; 14 | 15 | const db = drizzle({ client: sql }) 16 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/mysql/CreateTable.mdx: -------------------------------------------------------------------------------- 1 | Create a `schema.ts` file in the `src/db` directory and declare your table: 2 | 3 | ```typescript copy filename="src/db/schema.ts" 4 | import { int, mysqlTable, serial, varchar } from 'drizzle-orm/mysql-core'; 5 | 6 | export const usersTable = mysqlTable('users_table', { 7 | id: serial().primaryKey(), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: int().notNull(), 10 | email: varchar({ length: 255 }).notNull().unique(), 11 | }); 12 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/FileStructure.mdx: -------------------------------------------------------------------------------- 1 | #### Basic file structure 2 | 3 | This is the basic file structure of the project. In the `src/db` directory, we have table definition in `schema.ts`. In `drizzle` folder there are sql migration file and snapshots. 4 | 5 | ```plaintext 6 | 📦 7 | ├ 📂 drizzle 8 | ├ 📂 src 9 | │ ├ 📂 db 10 | │ │ └ 📜 schema.ts 11 | │ └ 📜 index.ts 12 | ├ 📜 .env 13 | ├ 📜 drizzle.config.ts 14 | ├ 📜 package.json 15 | └ 📜 tsconfig.json 16 | ``` 17 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0312.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.31.2 release 3 | pubDate: 2024-06-07 4 | description: Added support for TiDB Cloud Serverless driver 5 | --- 6 | 7 | - 🎉 Added support for TiDB Cloud Serverless driver: 8 | 9 | ```ts 10 | import { connect } from '@tidbcloud/serverless'; 11 | import { drizzle } from 'drizzle-orm/tidb-serverless'; 12 | 13 | const client = connect({ url: '...' }); 14 | const db = drizzle(client); 15 | await db.select().from(...); 16 | ``` 17 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/CreateTable.mdx: -------------------------------------------------------------------------------- 1 | Create a `schema.ts` file in the `src/db` directory and declare your table: 2 | 3 | ```typescript copy filename="src/db/schema.ts" 4 | import { integer, pgTable, varchar } from "drizzle-orm/pg-core"; 5 | 6 | export const usersTable = pgTable("users", { 7 | id: integer().primaryKey().generatedAlwaysAsIdentity(), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: integer().notNull(), 10 | email: varchar({ length: 255 }).notNull().unique(), 11 | }); 12 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/singlestore/CreateSingleStoreTable.mdx: -------------------------------------------------------------------------------- 1 | Create a `schema.ts` file in the `src/db` directory and declare your table: 2 | 3 | ```typescript copy filename="src/db/schema.ts" 4 | import { int, singlestoreTable, varchar } from 'drizzle-orm/singlestore-core'; 5 | 6 | export const usersTable = singlestoreTable('users_table', { 7 | id: int().primaryKey(), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: int().notNull(), 10 | email: varchar({ length: 255 }).notNull().unique(), 11 | }); 12 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/cockroach/CreateTable.mdx: -------------------------------------------------------------------------------- 1 | Create a `schema.ts` file in the `src/db` directory and declare your table: 2 | 3 | ```typescript copy filename="src/db/schema.ts" 4 | import { int4, cockroachTable, varchar } from "drizzle-orm/cockroach-core"; 5 | 6 | export const usersTable = cockroachTable("users", { 7 | id: int4().primaryKey().generatedAlwaysAsIdentity(), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: int4().notNull(), 10 | email: varchar({ length: 255 }).notNull().unique(), 11 | }); 12 | ``` -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/formatNumber.ts: -------------------------------------------------------------------------------- 1 | export default (num: number) => { 2 | if (!num) { 3 | return "0"; 4 | } 5 | if (num < 1000) { 6 | return num.toString(); 7 | } 8 | if (num < 1000000) { 9 | return (num / 1000).toFixed(1).endsWith(".0") 10 | ? `${Math.round(num / 1000)}k` 11 | : `${(num / 1000).toFixed(1)}k`; 12 | } 13 | return (num / 1000000).toFixed(1).endsWith(".0") 14 | ? `${Math.round(num / 1000000)}kk` 15 | : `${(num / 1000000).toFixed(1)}kk`; 16 | }; 17 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/getDemoBenchmarkData.ts: -------------------------------------------------------------------------------- 1 | import { type IData } from "../types"; 2 | import data from "../data/demoData.json"; 3 | import dataMapper from "@components/landing/benchmark/utils/dataMapper"; 4 | 5 | const getDemoBenchmarkData = (): null | { 6 | drizzleData: IData[]; 7 | compareData: IData[]; 8 | } => { 9 | return { 10 | drizzleData: dataMapper(data["drizzle-beta-bun"]), 11 | compareData: dataMapper(data["prisma-7-bun"]), 12 | }; 13 | }; 14 | 15 | export default getDemoBenchmarkData; 16 | -------------------------------------------------------------------------------- /src/ui/components/CustomHeader.astro: -------------------------------------------------------------------------------- 1 |
2 |

3 |
4 | 5 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectPgLite.mdx: -------------------------------------------------------------------------------- 1 | Create a `index.ts` file in the `src` directory and initialize the connection: 2 | 3 | ```typescript copy 4 | import { drizzle } from 'drizzle-orm/pglite'; 5 | 6 | const db = drizzle(process.env.DATABASE_URL!); 7 | ``` 8 | 9 | If you need to provide your existing driver: 10 | 11 | ```typescript copy 12 | import { PGlite } from '@electric-sql/pglite'; 13 | import { drizzle } from 'drizzle-orm/pglite'; 14 | 15 | const client = new PGlite(process.env.DATABASE_URL!); 16 | const db = drizzle({ client }); 17 | ``` -------------------------------------------------------------------------------- /public/inkeep-styles.css: -------------------------------------------------------------------------------- 1 | [data-theme='dark'] .ikp-floating-button { 2 | background-color: #1c1c1c !important; 3 | color: #c4c5c6; 4 | } 5 | 6 | .ikp-floating-button { 7 | height: 33px; 8 | background-color: #F4F4F4; 9 | border-radius: 4px; 10 | font-size: 14px; 11 | color: #333; 12 | transition: none; 13 | } 14 | 15 | .ikp-floating-button:hover { 16 | transform: none; 17 | } 18 | 19 | #inkeep-widget-root > div { 20 | visibility: visible !important; 21 | } 22 | 23 | [data-theme='light'] .ikp-bot-avatar__box { 24 | filter: brightness(0.2); 25 | } -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0321.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.32.1 release 3 | pubDate: 2024-07-23 4 | description: Bug fixes 5 | --- 6 | 7 | - Fix typings for indexes and allow creating indexes on 3+ columns mixing columns and expressions 8 | - Added support for "limit 0" in all dialects - closes [#2011](https://github.com/drizzle-team/drizzle-orm/issues/2011) 9 | - Make inArray and notInArray accept empty list, closes [#1295](https://github.com/drizzle-team/drizzle-orm/issues/1295) 10 | - fix typo in lt typedoc 11 | - fix wrong example in README.md -------------------------------------------------------------------------------- /src/mdx/get-started/mysql/ConnectTiDB.mdx: -------------------------------------------------------------------------------- 1 | Create a `index.ts` file in the `src/db` directory and initialize the connection: 2 | 3 | ```typescript copy 4 | import { drizzle } from 'drizzle-orm/tidb-serverless'; 5 | 6 | const db = drizzle(process.env.DATABASE_URL!); 7 | ``` 8 | 9 | If you need to provide your existing driver: 10 | ```typescript copy 11 | import { connect } from '@tidbcloud/serverless'; 12 | import { drizzle } from 'drizzle-orm/tidb-serverless'; 13 | 14 | const client = connect({ url: process.env.DATABASE_URL! }); 15 | const db = drizzle({ client: client }); 16 | ``` -------------------------------------------------------------------------------- /public/svg/database.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /public/svg/expo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/content/docs/kit-seed-data.mdx: -------------------------------------------------------------------------------- 1 | import CodeTab from '@mdx/CodeTab.astro'; 2 | import CodeTabs from '@mdx/CodeTabs.astro'; 3 | import Section from '@mdx/Section.astro'; 4 | import Tab from '@mdx/Tab.astro'; 5 | import Tabs from '@mdx/Tabs.astro'; 6 | import Callout from '@mdx/Callout.astro'; 7 | import Npm from '@mdx/Npm.astro'; 8 | import Npx from '@mdx/Npx.astro'; 9 | import Steps from '@mdx/Steps.astro'; 10 | import Prerequisites from "@mdx/Prerequisites.astro" 11 | 12 | # Drizzle Kit data seeding 13 | 14 | This section will be updated right after our release of `drizzle-seed` package. -------------------------------------------------------------------------------- /src/content/docs/connect-react-native-sqlite.mdx: -------------------------------------------------------------------------------- 1 | import Npm from "@mdx/Npm.astro"; 2 | import Callout from '@mdx/Callout.astro'; 3 | import AnchorCards from '@mdx/AnchorCards.astro'; 4 | import Steps from '@mdx/Steps.astro'; 5 | 6 | # Drizzle \<\> React Native SQLite 7 | Please use [`Expo SQLite`](#expo-sqlite) to run Drizzle ORM with React Native apps. 8 | The only [popular library](https://github.com/andpor/react-native-sqlite-storage) we've found does not support new Hermes JavaScript runtime, 9 | which is a standard out of the box runtime for React Native and Expo now. 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0284.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.28.4 release 3 | pubDate: 2023-08-24 4 | description: Fixed imports in ESM-based projects and type error on Postgres table definitions. 5 | --- 6 | 7 | ## Fixes: 8 | 9 | - Fixed imports in ESM-based projects ([#1088](https://github.com/drizzle-team/drizzle-orm/issues/1088)) 10 | - Fixed type error on Postgres table definitions ([#1089](https://github.com/drizzle-team/drizzle-orm/issues/1089)) 11 | 12 | ⚠ If you are facing a `Cannot find package '@opentelemetry/api'` error, please update to `0.28.5`, it's fixed there. 13 | -------------------------------------------------------------------------------- /src/mdx/Tag.astro: -------------------------------------------------------------------------------- 1 | --- 2 | const { style } = Astro.props; 3 | --- 4 | 5 |
6 | 7 |
8 | 9 | 26 | 27 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/utils/Logo.tsx: -------------------------------------------------------------------------------- 1 | import { type FC } from "react"; 2 | import DrizzleLogo from "@/assets/icons/DrizzleLogo"; 3 | import PrismaIcon from "@/assets/icons/PrismaIcon"; 4 | import GoIcon from "@/assets/icons/GoIcon"; 5 | 6 | interface Props { 7 | logo: string; 8 | } 9 | 10 | const Logo: FC = ({ logo }) => { 11 | if (logo.startsWith("drizzle")) { 12 | return ; 13 | } 14 | if (logo.startsWith("prisma")) { 15 | return ; 16 | } 17 | if (logo.startsWith("go")) { 18 | return ; 19 | } 20 | return null; 21 | }; 22 | 23 | export default Logo; 24 | -------------------------------------------------------------------------------- /public/svg/planetscale.svg: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /public/svg/prisma-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/svg/prisma.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "astro/tsconfigs/strict", 3 | "exclude": ["node_modules", "dist", "public", "./src/ui/BaseHead.astro", "./src/ui/Layout.astro", "./src/ui/DocsLayout.astro", "./src/ui/CenteredLayout.astro"], 4 | "compilerOptions": { 5 | "baseUrl": "./src", 6 | "paths": { 7 | "@mdx/*": [ 8 | "mdx/*" 9 | ], 10 | "@components/*": [ 11 | "ui/components/*" 12 | ], 13 | "@/*": [ 14 | "*" 15 | ] 16 | }, 17 | "jsx": "react-jsx", 18 | "jsxImportSource": "react", 19 | "types": ["vite/client"] 20 | }, 21 | "include": ["./src/", "./src/types/declarations.d.ts"] 22 | } -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/SpeedSelector/SpeedSelector.module.css: -------------------------------------------------------------------------------- 1 | html[class~=dark] .button { 2 | border: 1px solid #414141; 3 | background-color: #111111; 4 | } 5 | 6 | .button { 7 | display: flex; 8 | align-items: center; 9 | justify-content: center; 10 | font-weight: 600; 11 | height: 32px; 12 | padding: 0px 20px; 13 | width: 70px; 14 | font-size: 14px; 15 | line-height: 14px; 16 | border: 1px solid rgb(225, 225, 225); 17 | border-radius: 2px; 18 | background-color: #ffffff; 19 | cursor: pointer; 20 | outline: none; 21 | appearance: none; 22 | text-align: center; 23 | text-align-last: center; 24 | text-transform: uppercase; 25 | } -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/Timer/Timer.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from "react"; 2 | import styles from "./Timer.module.css"; 3 | 4 | interface IProps { 5 | time: number; 6 | } 7 | 8 | const Timer: FC = ({ time }) => { 9 | const minutes = Math.floor((time % 360000) / 6000); 10 | const seconds = Math.floor((time % 6000) / 100); 11 | const milliseconds = time % 100; 12 | 13 | return ( 14 |
15 | {minutes.toString().padStart(2, "0")}: 16 | {seconds.toString().padStart(2, "0")}: 17 | {milliseconds.toString().padStart(2, "0")} 18 |
19 | ); 20 | }; 21 | 22 | export default Timer; 23 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/BenchmarkConfig/BenchmarkConfig.module.css: -------------------------------------------------------------------------------- 1 | .items { 2 | font-size: 12px; 3 | } 4 | 5 | html[class~=dark] .main-info { 6 | color: #f0f0f0; 7 | } 8 | 9 | .main-info { 10 | font-size: 14px; 11 | line-height: 14px; 12 | color: #222222; 13 | } 14 | 15 | html[class~=dark] .additional-info { 16 | color: #c0c0c0; 17 | } 18 | 19 | .additional-info { 20 | font-size: 12px; 21 | line-height: 12px; 22 | color: #666666; 23 | } 24 | 25 | .main-items { 26 | display: flex; 27 | flex-direction: column; 28 | gap: 4px; 29 | } 30 | 31 | .additional-items { 32 | display: flex; 33 | flex-direction: column; 34 | gap: 4px; 35 | } -------------------------------------------------------------------------------- /src/mdx/Cards.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import type { ICards } from '@/types'; 3 | 4 | import Card from './Card.astro'; 5 | 6 | interface Props { 7 | cards: ICards; 8 | } 9 | 10 | const { cards } = Astro.props; 11 | const svgs = import.meta.glob>('/public/svg/*.svg', { query: '?raw', import: "default" }); 12 | 13 | --- 14 |
15 | {Object.keys(cards).map((name) => )} 16 |
17 | -------------------------------------------------------------------------------- /src/mdx/get-started/mssql/UpdateSchema.mdx: -------------------------------------------------------------------------------- 1 | If you want to update your table schema, you can do it in the `schema.ts` file. For example, let's add a new column `phone` to the `users_table`: 2 | 3 | ```typescript copy filename="src/db/schema.ts" {8} 4 | import { mssqlTable, int, varchar, unique, primaryKey } from "drizzle-orm/mssql-core" 5 | 6 | export const users = mssqlTable("users", { 7 | id: int(), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: int().notNull(), 10 | email: varchar({ length: 255 }).notNull(), 11 | phone: varchar({ length: 255 }) 12 | }, (table) => [ 13 | primaryKey({ columns: [table.id], name: "users_pkey"}), 14 | unique("users_email_key").on(table.email) 15 | ]); 16 | ``` 17 | -------------------------------------------------------------------------------- /public/svg/sentry-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/svg/sentry-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/icons/TypeScriptIcon.astro: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/JoinsSelector/JoinsSelector.module.css: -------------------------------------------------------------------------------- 1 | html[class~=dark] .button { 2 | border: 1px solid #414141; 3 | background-color: #111111; 4 | } 5 | 6 | .button { 7 | display: flex; 8 | align-items: center; 9 | justify-content: center; 10 | font-weight: 500; 11 | height: 28px; 12 | font-size: 12px; 13 | line-height: 14px; 14 | box-shadow: 0 0 0 0 #fff,0 0 0 1px rgba(0,0,0,.08),0 1px 2px 0 rgba(0,0,0,.1),0 2px 4px 0 rgba(0,0,0,.075); 15 | border-radius: 4px; 16 | background-color: #ffffff; 17 | cursor: pointer; 18 | outline: none; 19 | appearance: none; 20 | text-align: center; 21 | padding: 0 12px; 22 | text-align-last: center; 23 | font-family: var(--default-font); 24 | } -------------------------------------------------------------------------------- /src/content/docs/kit-web-mobile.mdx: -------------------------------------------------------------------------------- 1 | import CodeTab from '@mdx/CodeTab.astro'; 2 | import CodeTabs from '@mdx/CodeTabs.astro'; 3 | import Section from '@mdx/Section.astro'; 4 | import Tab from '@mdx/Tab.astro'; 5 | import Tabs from '@mdx/Tabs.astro'; 6 | import Callout from '@mdx/Callout.astro'; 7 | import Npm from '@mdx/Npm.astro'; 8 | import Npx from '@mdx/Npx.astro'; 9 | import Steps from '@mdx/Steps.astro'; 10 | import Prerequisites from "@mdx/Prerequisites.astro" 11 | 12 | # Drizzle migrations in web and mobile environments 13 | 14 | This section will be updated in the next release. 15 | 16 | For **Expo SQLite**, **OP SQLite** and **React Native** migrations - please refer to our [Get Started](/docs/get-started/expo-new) guide. -------------------------------------------------------------------------------- /src/mdx/get-started/TransferCode.mdx: -------------------------------------------------------------------------------- 1 | We recommend transferring the generated code from `drizzle/schema.ts` and `drizzle/relations.ts` to the actual schema file. In this guide we transferred code to `src/db/schema.ts`. Generated files for schema and relations can be deleted. This way you can manage your schema in a more structured way. 2 | ```plaintext {5-6} 3 | ├ 📂 drizzle 4 | │ ├ 📂 20242409125510_premium_mister_fear 5 | │ │ ├ 📜 snapshot.json 6 | │ │ └ 📜 migration.sql 7 | │ ├ 📜 relations.ts ────────┐ 8 | │ └ 📜 schema.ts ───────────┤ 9 | ├ 📂 src │ 10 | │ ├ 📂 db │ 11 | │ │ ├ 📜 relations.ts <─────┤ 12 | │ │ └ 📜 schema.ts <────────┘ 13 | │ └ 📜 index.ts 14 | └ … 15 | ``` -------------------------------------------------------------------------------- /src/content/announcements/0002.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2025-10-21 22:00:00 3 | --- 4 | **We’ve reworked the schema viewer in the SQL console ⚙️** 5 |
6 |
7 | The schema now lives in the right panel, giving you everything you need to explore your database structure quickly. 8 | You can expand specific tables or all at once, and hide the ones you don't need. 9 | Row counts, nullability, and default values are shown based on your settings. 10 | We've spent quite some time making it adaptable to different panel sizes – hope you like it! 11 |
12 |
13 | If you have any feedback, share it with us on [Discord](https://discord.com/channels/1043890932593987624/1124768693549797416). 14 | ![alt text](@/assets/images/announcements/0002-01.jpg) -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0313.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.31.3 release 3 | pubDate: 2024-07-08 4 | description: Prisma-Drizzle extension 5 | --- 6 | 7 | ### Bug fixed 8 | 9 | - 🛠️ Fixed RQB behavior for tables with same names in different schemas 10 | - 🛠️ Fixed [BUG]: Mismatched type hints when using RDS Data API - #2097 11 | 12 | ### New Prisma-Drizzle extension 13 | 14 | ```ts 15 | import { PrismaClient } from '@prisma/client'; 16 | import { drizzle } from 'drizzle-orm/prisma/pg'; 17 | import { User } from './drizzle'; 18 | 19 | const prisma = new PrismaClient().$extends(drizzle()); 20 | const users = await prisma.$drizzle.select().from(User); 21 | ``` 22 | 23 | For more info, check docs: /docs/prisma 24 | -------------------------------------------------------------------------------- /src/mdx/get-started/cockroach/UpdateSchema.mdx: -------------------------------------------------------------------------------- 1 | If you want to update your table schema, you can do it in the `schema.ts` file. For example, let's add a new column `phone` to the `users_table`: 2 | 3 | ```typescript copy filename="src/db/schema.ts" {9} 4 | import { cockroachTable, unique, int4, varchar } from "drizzle-orm/cockroach-core" 5 | 6 | export const users = cockroachTable("users", { 7 | id: int4().primaryKey().generatedAlwaysAsIdentity({ name: "users_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), 8 | name: varchar({ length: 255 }).notNull(), 9 | age: integer().notNull(), 10 | email: varchar({ length: 255 }).notNull(), 11 | phone: varchar(), 12 | }, (table) => [ 13 | unique("users_email_unique").on(table.email) 14 | ]); 15 | ``` 16 | -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/UpdateSchema.mdx: -------------------------------------------------------------------------------- 1 | If you want to update your table schema, you can do it in the `schema.ts` file. For example, let's add a new column `phone` to the `users_table`: 2 | 3 | ```typescript copy filename="src/db/schema.ts" {16} 4 | // table schema generated by introspection 5 | import { 6 | sqliteTable, 7 | uniqueIndex, 8 | integer, 9 | text, 10 | } from "drizzle-orm/sqlite-core"; 11 | 12 | export const usersTable = sqliteTable( 13 | "users_table", 14 | { 15 | id: integer().primaryKey({ autoIncrement: true }).notNull(), 16 | name: text().notNull(), 17 | age: integer().notNull(), 18 | email: text().notNull(), 19 | phone: text(), 20 | }, 21 | (table) => [ 22 | uniqueIndex("users_table_email_unique").on(table.email) 23 | ] 24 | ); 25 | ``` -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0307.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.7 release 3 | pubDate: 2024-04-03 4 | description: Added mappings for '@vercel/postgres' package and fixed interval mapping for neon drivers. 5 | --- 6 | 7 | ## Fixes 8 | 9 | - Add mappings for `@vercel/postgres` package 10 | 11 | Read more about Vercel Postgres [here](https://vercel.com/docs/storage/vercel-postgres). To get started with Drizzle and Vercel Postgres follow the [documentation](/docs/get-started-postgresql#vercel-postgres). 12 | 13 | - Fix interval mapping for `neon` drivers - [#1542](https://github.com/drizzle-team/drizzle-orm/issues/1542) 14 | 15 | Read more about Neon [here](https://neon.tech/). To get started with Drizzle and Neon follow the [documentation](/docs/get-started-postgresql#neon). 16 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/RuntimeSelector/RuntimeSelector.module.css: -------------------------------------------------------------------------------- 1 | html[class~=dark] .button { 2 | border: 1px solid #414141; 3 | background-color: #111111; 4 | } 5 | 6 | .button { 7 | display: flex; 8 | align-items: center; 9 | justify-content: center; 10 | font-weight: 500; 11 | height: 28px; 12 | font-size: 12px; 13 | line-height: 14px; 14 | box-shadow: 0 0 0 0 #fff,0 0 0 1px rgba(0,0,0,.08),0 1px 2px 0 rgba(0,0,0,.1),0 2px 4px 0 rgba(0,0,0,.075); 15 | border-radius: 4px; 16 | background-color: #ffffff; 17 | cursor: pointer; 18 | outline: none; 19 | appearance: none; 20 | padding: 0 12px 0 30px; 21 | font-family: var(--default-font); 22 | } 23 | 24 | .icon { 25 | margin-right: -24px; 26 | position: relative; 27 | z-index: 2; 28 | pointer-events: none; 29 | } -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0301.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.1 release 3 | pubDate: 2024-03-08 4 | description: Added support for op-sqlite driver and fixed migration hook for Expo driver. 5 | --- 6 | 7 | ## New Features 8 | 9 | ### 🎉 OP-SQLite driver Support 10 | 11 | Usage Example 12 | 13 | ```ts copy {4,5,6,8} 14 | import { open } from '@op-engineering/op-sqlite'; 15 | import { drizzle } from 'drizzle-orm/op-sqlite'; 16 | 17 | const opsqlite = open({ 18 | name: 'myDB', 19 | }); 20 | 21 | const db = drizzle(opsqlite); 22 | 23 | await db.select().from(users); 24 | ``` 25 | 26 | For more usage and setup details, please check our [op-sqlite docs](http://orm.drizzle.team/docs/get-started-sqlite#op-sqlite) 27 | 28 | ## Fixes 29 | 30 | - Migration hook fixed for Expo driver 31 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectNeon.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | import CodeTabs from "@mdx/CodeTabs.astro"; 3 | import Section from "@mdx/Section.astro"; 4 | 5 | Create a `index.ts` file in the `src` directory and initialize the connection: 6 | 7 | ```typescript 8 | import { drizzle } from 'drizzle-orm/neon-http'; 9 | 10 | const db = drizzle(process.env.DATABASE_URL); 11 | ``` 12 | 13 | If you need a synchronous connection, you can use our additional connection API, 14 | where you specify a driver connection and pass it to the Drizzle instance. 15 | 16 | ```typescript 17 | import { neon } from '@neondatabase/serverless'; 18 | import { drizzle } from 'drizzle-orm/neon-http'; 19 | 20 | const sql = neon(process.env.DATABASE_URL!); 21 | const db = drizzle({ client: sql }); 22 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/UpdateSchema.mdx: -------------------------------------------------------------------------------- 1 | If you want to update your table schema, you can do it in the `schema.ts` file. For example, let's add a new column `phone` to the `users_table`: 2 | 3 | ```typescript copy filename="src/db/schema.ts" {9} 4 | import { pgTable, unique, integer, varchar } from "drizzle-orm/pg-core" 5 | import { sql } from "drizzle-orm" 6 | 7 | export const users = pgTable("users", { 8 | id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "users_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), 9 | name: varchar({ length: 255 }).notNull(), 10 | age: integer().notNull(), 11 | email: varchar({ length: 255 }).notNull(), 12 | phone: varchar(), 13 | }, (table) => [ 14 | unique("users_email_unique").on(table.email) 15 | ]); 16 | ``` 17 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectXata.mdx: -------------------------------------------------------------------------------- 1 | Create a `index.ts` file in the `src` directory and initialize the connection: 2 | 3 | ```typescript copy filename="index.ts" 4 | import { drizzle } from 'drizzle-orm' 5 | 6 | async function main() { 7 | const db = drizzle('postgres-js', process.env.DATABASE_URL); 8 | } 9 | 10 | main(); 11 | ``` 12 | If you need a synchronous connection, you can use our additional connection API, 13 | where you specify a driver connection and pass it to the Drizzle instance. 14 | 15 | ```typescript copy filename="index.ts" 16 | import { drizzle } from 'drizzle-orm/postgres-js' 17 | import postgres from 'postgres' 18 | 19 | async function main() { 20 | const client = postgres(process.env.DATABASE_URL) 21 | const db = drizzle({ client }); 22 | } 23 | 24 | main(); 25 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/SetupConfig.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | **Drizzle config** - a configuration file that is used by [Drizzle Kit](/docs/kit-overview) and contains all the information about your database connection, migration folder and schema files. 4 | 5 | Create a `drizzle.config.ts` file in the root of your project and add the following content: 6 | 7 | 8 | ```typescript copy filename="drizzle.config.ts" 9 | import 'dotenv/config'; 10 | import { defineConfig } from 'drizzle-kit'; 11 | 12 | export default defineConfig({ 13 | out: './drizzle', 14 | schema: './src/db/schema.ts', 15 | dialect: '$dialect$', 16 | dbCredentials: { 17 | url: process.env.$env_variable$!, 18 | }, 19 | }); 20 | ``` 21 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/MdxBenchmark.module.css: -------------------------------------------------------------------------------- 1 | .mdx-benchmark__wrap { 2 | margin-top: 24px; 3 | display: block; 4 | width: fit-content; 5 | } 6 | 7 | html[class~=dark] .bottom a { 8 | color: #f9f9f9; 9 | font-size: 12px; 10 | } 11 | 12 | .bottom { 13 | display: flex; 14 | align-items: center; 15 | justify-content: flex-end; 16 | margin-top: 8px; 17 | width: 100%; 18 | } 19 | 20 | .bottom a { 21 | color: #444; 22 | text-decoration: none; 23 | } 24 | 25 | .bottom a:hover { 26 | text-decoration: underline; 27 | text-decoration-style: dashed; 28 | } 29 | 30 | @media screen and (max-width: 1200px) { 31 | .mdx-benchmark__wrap { 32 | display: flex; 33 | flex-direction: column; 34 | align-items: center; 35 | width: 100%; 36 | } 37 | .bottom { 38 | display: none; 39 | } 40 | } -------------------------------------------------------------------------------- /src/assets/icons/JavaScriptIcon.astro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/icons/PrismaIcon.tsx: -------------------------------------------------------------------------------- 1 | const PrismaIcon = () => ( 2 | 9 | 14 | 15 | ); 16 | 17 | export default PrismaIcon; 18 | -------------------------------------------------------------------------------- /src/mdx/get-started/mysql/ConnectPlanetScale.mdx: -------------------------------------------------------------------------------- 1 | Create a `index.ts` file in the `src/db` directory and initialize the connection: 2 | 3 | ```typescript copy 4 | import { drizzle } from "drizzle-orm/planetscale-serverless"; 5 | 6 | const db = drizzle({ connection: { 7 | host: process.env.DATABASE_HOST!, 8 | username: process.env.DATABASE_USERNAME!, 9 | password: process.env.DATABASE_PASSWORD!, 10 | }}); 11 | ``` 12 | 13 | If you need to provide your existing driver 14 | ```typescript copy" 15 | import { drizzle } from "drizzle-orm/planetscale-serverless"; 16 | import { Client } from "@planetscale/database"; 17 | 18 | const client = new Client({ 19 | host: process.env.DATABASE_HOST!, 20 | username: process.env.DATABASE_USERNAME!, 21 | password: process.env.DATABASE_PASSWORD!, 22 | }); 23 | 24 | const db = drizzle({ client: client }); 25 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/ConnectSQLiteCloud.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | import CodeTabs from "@mdx/CodeTabs.astro"; 3 | import Section from "@mdx/Section.astro"; 4 | 5 | Create a `index.ts` file in the `src` directory and initialize the connection: 6 | 7 | ```typescript 8 | import { drizzle } from 'drizzle-orm/sqlite-cloud'; 9 | 10 | const db = drizzle(process.env.SQLITE_CLOUD_CONNECTION_STRING); 11 | ``` 12 | 13 | If you need a synchronous connection, you can use our additional connection API, 14 | where you specify a driver connection and pass it to the Drizzle instance. 15 | 16 | ```typescript 17 | import { Database } from '@sqlitecloud/drivers'; 18 | import { drizzle } from 'drizzle-orm/sqlite-cloud'; 19 | 20 | const client = new Database(process.env.SQLITE_CLOUD_CONNECTION_STRING!); 21 | const db = drizzle({ client }); 22 | ``` -------------------------------------------------------------------------------- /src/content/docs/perf-serverless.mdx: -------------------------------------------------------------------------------- 1 | # Drizzle Serverless performance 2 | 3 | You can get immense benefits with `serverless functions` like AWS Lambda or Vercel Server Functions (they're AWS Lambda based), 4 | since they can live up to 15mins and reuse both database connections and prepared statements. 5 | 6 | On the other, hand `edge functions` tend to clean up straight after they're invoked which leads to little to no performance benefits. 7 | 8 | To reuse your database connection and prepared statements you just have to declare them outside of handler scope: 9 | ```ts 10 | const databaseConnection = ...; 11 | const db = drizzle({ client: databaseConnection }); 12 | const prepared = db.select().from(...).prepare(); 13 | 14 | // AWS handler 15 | export const handler = async (event: APIGatewayProxyEvent) => { 16 | return prepared.execute(); 17 | } 18 | ``` 19 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/MdxBenchmark.tsx: -------------------------------------------------------------------------------- 1 | import { BenchmarkProvider } from "./context/useBenchmarkContext"; 2 | import ControlPanel from "./components/ControlPanel/ControlPanel"; 3 | import styles from "./MdxBenchmark.module.css"; 4 | 5 | const MDXBenchmark = () => { 6 | return ( 7 | 8 |
9 | 10 | 20 |
21 |
22 | ); 23 | }; 24 | 25 | export default MDXBenchmark; 26 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v03010.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.10 release 3 | pubDate: 2024-05-01 4 | description: Added '.if()' function to all WHERE expressions and fixed internal mappings for sessions '.all', '.values', '.execute' functions in AWS DataAPI. 5 | --- 6 | 7 | ## New Features 8 | 9 | ### 🎉 `.if()` function added to all WHERE expressions 10 | 11 | #### Select all posts with views greater than 100 12 | 13 | ```ts {5} 14 | async function someFunction(views = 0) { 15 | await db 16 | .select() 17 | .from(posts) 18 | .where(gt(posts.views, views).if(views > 100)); 19 | } 20 | ``` 21 | 22 | ## Bug Fixes 23 | 24 | - Fixed internal mappings for sessions `.all`, `.values`, `.execute` functions in AWS DataAPI 25 | 26 | Read get started guide with AWS DataAPI in the [documentation](/docs/get-started-postgresql#aws-data-api). 27 | -------------------------------------------------------------------------------- /public/svg/gel_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /public/svg/gel_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /public/svg/gel_transparent.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/mdx/IsSupportedChip.astro: -------------------------------------------------------------------------------- 1 | --- 2 | interface Props { 3 | text: string; 4 | isSupported: boolean; 5 | } 6 | 7 | const { text, isSupported } = Astro.props; 8 | --- 9 |
10 | {isSupported ? ( 11 | 12 | ) : ( 13 | 14 | )} 15 |
{text}
16 |
17 | -------------------------------------------------------------------------------- /src/pages/docs/tutorials/[...slug].astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { getCollection } from "astro:content"; 3 | import CustomHeader from "@components/CustomHeader.astro"; 4 | import Link from "@mdx/Link.astro"; 5 | import DocsLayout from "@/ui/DocsLayout.astro"; 6 | 7 | export async function getStaticPaths() { 8 | const releasesEntries = await getCollection("docs", ({ id }) => { 9 | return id.startsWith("tutorials/"); 10 | }); 11 | return releasesEntries.map((entry) => ({ 12 | params: { slug: entry.slug.split("/").at(-1) }, 13 | props: { entry }, 14 | })); 15 | } 16 | 17 | const { entry } = Astro.props; 18 | const { Content } = await entry.render(); 19 | --- 20 | 21 | {entry.data?.title && {entry.data.title}} 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/SpeedSelector/SpeedSelector.tsx: -------------------------------------------------------------------------------- 1 | import React, { type FC } from "react"; 2 | 3 | import styles from "./SpeedSelector.module.css"; 4 | 5 | interface IProps { 6 | speed: number; 7 | setSpeed: (speed: number) => void; 8 | } 9 | 10 | const SpeedSelector: FC = ({ speed, setSpeed }) => { 11 | const items = [1, 2, 4, 8, 16, 32]; 12 | 13 | const handleChange: React.ChangeEventHandler = (event) => { 14 | setSpeed(event.target.value as unknown as number); 15 | }; 16 | 17 | return ( 18 | 29 | ); 30 | }; 31 | 32 | export default SpeedSelector; 33 | -------------------------------------------------------------------------------- /src/mdx/get-started/RunFile.mdx: -------------------------------------------------------------------------------- 1 | import Npx from '@mdx/Npx.astro'; 2 | import Callout from '@mdx/Callout.astro'; 3 | 4 | To run any TypeScript files, you have several options, but let's stick with one: using `tsx` 5 | 6 | You've already installed `tsx`, so we can run our queries now 7 | 8 | **Run `index.ts` script** 9 | 10 | tsx src/index.ts 11 | 12 | 13 | 14 | We suggest using `bun` to run TypeScript files. With `bun`, such scripts can be executed without issues or additional 15 | settings, regardless of whether your project is configured with CommonJS (CJS), ECMAScript Modules (ESM), or any other module format. 16 | To run a script with `bun`, use the following command: 17 | ```bash copy 18 | bun src/index.ts 19 | ``` 20 | 21 | If you don't have bun installed, check the [Bun installation docs](https://bun.sh/docs/installation#installing) 22 | -------------------------------------------------------------------------------- /src/pages/docs/migrate/[...slug].astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { getCollection } from "astro:content"; 3 | 4 | import Link from "@mdx/Link.astro"; 5 | import CustomHeader from "@components/CustomHeader.astro"; 6 | import DocsLayout from "@/ui/DocsLayout.astro"; 7 | 8 | export async function getStaticPaths() { 9 | const releasesEntries = await getCollection("docs", ({ id }) => { 10 | return id.startsWith("migrate/"); 11 | }); 12 | return releasesEntries.map((entry) => ({ 13 | params: { slug: entry.slug.split("/").at(-1) }, 14 | props: { entry }, 15 | })); 16 | } 17 | 18 | const { entry } = Astro.props; 19 | const { Content } = await entry.render(); 20 | --- 21 | 22 | 23 | {entry.data?.title && {entry.data.title}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/mdx/WhatsNextMSSQL.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import Flex from "@mdx/Flex.astro" 3 | import LinksList from "@mdx/LinksList.astro" 4 | --- 5 | 6 | 7 | 17 | 29 | -------------------------------------------------------------------------------- /src/ui/components/DialectTab.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import type { ICard } from "@/types"; 3 | interface Props { 4 | card: ICard; 5 | } 6 | 7 | const { card } = Astro.props; 8 | 9 | const { title } = card; 10 | --- 11 | 12 |
13 |
14 |

{title}

15 |
16 |
17 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0303.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.3 release 3 | pubDate: 2024-03-19 4 | description: Added raw query support to batch API in Neon HTTP driver, fixed '@neondatabase/serverless' HTTP driver types issue, and fixed sqlite-proxy driver '.run()' result. 5 | --- 6 | 7 | ## New Features 8 | 9 | - Added raw query support (`db.execute(...)`) to batch API in Neon HTTP driver 10 | 11 | To get started with Neon and Drizzle follow the [documentation](/docs/get-started-postgresql#neon) 12 | 13 | ## Fixes 14 | 15 | - Fixed `@neondatabase/serverless` HTTP driver types issue ([#1945](https://github.com/drizzle-team/drizzle-orm/issues/1945), [neondatabase/serverless#66](https://github.com/neondatabase/serverless/issues/66)) 16 | - Fixed sqlite-proxy driver `.run()` result 17 | 18 | To get started with SQLite proxy driver and Drizzle follow the [documentation](/docs/get-started-sqlite#http-proxy) 19 | -------------------------------------------------------------------------------- /public/svg/quote.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/CrossOutIcon.astro: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/mdx/get-started/ApplyChanges.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | 3 | You can directly apply changes to your database using the `drizzle-kit push` command. This is a convenient method for quickly testing new schema designs or modifications in a local development environment, allowing for rapid iterations without the need to manage migration files: 4 | 5 | ```bash copy 6 | npx drizzle-kit push 7 | ``` 8 | 9 | Read more about the push command in [documentation](/docs/drizzle-kit-push). 10 | 11 | 12 | Alternatively, you can generate migrations using the `drizzle-kit generate` command and then apply them using the `drizzle-kit migrate` command: 13 | 14 | Generate migrations: 15 | ```bash copy 16 | npx drizzle-kit generate 17 | ``` 18 | 19 | Apply migrations: 20 | ```bash copy 21 | npx drizzle-kit migrate 22 | ``` 23 | 24 | Read more about migration process in [documentation](/docs/kit-overview). 25 | -------------------------------------------------------------------------------- /src/mdx/get-started/mysql/UpdateSchema.mdx: -------------------------------------------------------------------------------- 1 | If you want to update your table schema, you can do it in the `schema.ts` file. For example, let's add a new column `phone` to the `users_table`: 2 | 3 | ```typescript copy filename="src/db/schema.ts" {20} 4 | import { 5 | mysqlTable, 6 | mysqlSchema, 7 | AnyMySqlColumn, 8 | primaryKey, 9 | unique, 10 | serial, 11 | varchar, 12 | int, 13 | } from 'drizzle-orm/mysql-core'; 14 | import { sql } from 'drizzle-orm'; 15 | 16 | export const usersTable = mysqlTable( 17 | 'users_table', 18 | { 19 | id: serial().notNull(), 20 | name: varchar({ length: 255 }).notNull(), 21 | age: int().notNull(), 22 | email: varchar({ length: 255 }).notNull(), 23 | phone: varchar({ length: 255 }), 24 | }, 25 | (table) => [ 26 | primaryKey({ columns: [table.id], name: 'users_table_id' }), 27 | unique('id').on(table.id), 28 | unique('users_table_email_unique').on(table.email), 29 | ], 30 | ); 31 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectBun.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/bun-sql'; 9 | 10 | const db = drizzle(process.env.DATABASE_URL!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/bun-sql'; 15 | 16 | // You can specify any property from the bun sql connection options 17 | const db = drizzle({ connection: { url: process.env.DATABASE_URL! }}); 18 | ``` 19 | 20 | 21 | If you need to provide your existing driver: 22 | ```typescript copy 23 | import 'dotenv/config'; 24 | import { drizzle } from 'drizzle-orm/bun-sql'; 25 | import { SQL } from 'bun'; 26 | 27 | const client = new SQL(process.env.DATABASE_URL!); 28 | const db = drizzle({ client }); 29 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/singlestore/UpdateSchema.mdx: -------------------------------------------------------------------------------- 1 | If you want to update your table schema, you can do it in the `schema.ts` file. For example, let's add a new column `phone` to the `users_table`: 2 | 3 | ```typescript copy filename="src/db/schema.ts" {19} 4 | import { 5 | singlestoreTable, 6 | singlestoreSchema, 7 | AnySingleStoreColumn, 8 | primaryKey, 9 | unique, 10 | varchar, 11 | int, 12 | } from 'drizzle-orm/singlestore-core'; 13 | import { sql } from 'drizzle-orm'; 14 | 15 | export const usersTable = singlestoreTable( 16 | 'users_table', 17 | { 18 | id: int().notNull(), 19 | name: varchar({ length: 255 }).notNull(), 20 | age: int().notNull(), 21 | email: varchar({ length: 255 }).notNull(), 22 | phone: varchar({ length: 255 }), 23 | }, 24 | (table) => [ 25 | primaryKey({ columns: [table.id], name: 'users_table_id' }), 26 | unique('id').on(table.id), 27 | unique('users_table_email_unique').on(table.email), 28 | ], 29 | ); 30 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/ConnectLibsql.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/libsql'; 9 | 10 | const db = drizzle(process.env.DB_FILE_NAME!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/libsql'; 15 | 16 | // You can specify any property from the libsql connection options 17 | const db = drizzle({ connection: { url: process.env.DB_FILE_NAME! }}); 18 | ``` 19 | 20 | 21 | If you need to provide your existing driver: 22 | 23 | ```typescript copy 24 | import 'dotenv/config'; 25 | import { drizzle } from 'drizzle-orm/libsql'; 26 | import { createClient } from '@libsql/client'; 27 | 28 | const client = createClient({ url: process.env.DB_FILE_NAME! }); 29 | const db = drizzle({ client }); 30 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/ConnectBun.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/bun-sqlite'; 9 | 10 | const db = drizzle(process.env.DB_FILE_NAME!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/bun-sqlite'; 15 | 16 | // You can specify any property from the bun:sql connection options 17 | const db = drizzle({ connection: { source: process.env.DB_FILE_NAME! }}); 18 | ``` 19 | 20 | 21 | If you need to provide your existing driver: 22 | ```typescript copy 23 | import 'dotenv/config'; 24 | import { drizzle } from 'drizzle-orm/bun-sqlite'; 25 | import { Database } from 'bun:sqlite'; 26 | 27 | const sqlite = new Database(process.env.DB_FILE_NAME!); 28 | const db = drizzle({ client: sqlite }); 29 | ``` -------------------------------------------------------------------------------- /src/pages/llms-full.txt.ts: -------------------------------------------------------------------------------- 1 | import { description, title } from "@/data/llms"; 2 | import type { APIRoute } from "astro"; 3 | import { getCollection } from "astro:content"; 4 | 5 | export const GET: APIRoute = async ({ url }) => { 6 | let llms = `# ${title}\n\n> ${description}\n\n`; 7 | 8 | const docCollection = await getCollection("docs", (entry) => { 9 | return { 10 | slug: entry.slug, 11 | body: entry.body, 12 | } 13 | }); 14 | 15 | docCollection.filter((entry) => { 16 | if (entry.slug.includes("latest-releases") || entry.slug.includes("migrate/")) { 17 | return false; 18 | } 19 | return true; 20 | }).forEach((doc) => { 21 | if (doc.slug.includes("tutorials/")) { 22 | const tutorialSlug = doc.slug.split("/").at(-1); 23 | llms += `Source: ${url.origin}/docs/tutorials/${tutorialSlug}\n\n${doc.body}\n\n`; 24 | } else { 25 | llms += `Source: ${url.origin}/docs/${doc.slug}\n\n${doc.body}\n\n`; 26 | } 27 | }); 28 | 29 | return new Response(llms); 30 | }; 31 | -------------------------------------------------------------------------------- /src/assets/icons/DocsIcon.astro: -------------------------------------------------------------------------------- 1 | 7 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /src/mdx/WhatsNextPostgres.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import Flex from "@mdx/Flex.astro" 3 | import LinksList from "@mdx/LinksList.astro" 4 | --- 5 | 6 | 7 | 19 | 32 | -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/ConnectTursoDatabase.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/tursodatabase/database'; 9 | 10 | const db = drizzle(process.env.DB_FILE_NAME!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/tursodatabase/database'; 15 | 16 | // You can specify any property from the turso connection options 17 | const db = drizzle({ connection: { path: process.env.DB_FILE_NAME! }}); 18 | ``` 19 | 20 | 21 | If you need to provide your existing driver: 22 | 23 | ```typescript copy 24 | import 'dotenv/config'; 25 | import { Database } from '@tursodatabase/database'; 26 | import { drizzle } from 'drizzle-orm/tursodatabase/database'; 27 | 28 | const client = new Database(process.env.DB_FILE_NAME!); 29 | const db = drizzle({ client }); 30 | ``` -------------------------------------------------------------------------------- /src/mdx/get-started/cockroach/ConnectCockroach.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src/db` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/cockroach'; 9 | 10 | const db = drizzle(process.env.DATABASE_URL!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/cockroach'; 15 | 16 | // You can specify any property from the node-postgres connection options 17 | const db = drizzle({ 18 | connection: { 19 | connectionString: process.env.DATABASE_URL!, 20 | ssl: true 21 | } 22 | }); 23 | ``` 24 | ```typescript copy 25 | import 'dotenv/config'; 26 | import { drizzle } from "drizzle-orm/cockroach"; 27 | import { Pool } from "pg"; 28 | 29 | const pool = new Pool({ 30 | connectionString: process.env.DATABASE_URL!, 31 | }); 32 | const db = drizzle({ client: pool }); 33 | ``` 34 | 35 | -------------------------------------------------------------------------------- /src/mdx/get-started/mssql/ConnectMSSQL.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src/db` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/node-mssql'; 9 | 10 | const db = drizzle(process.env.DATABASE_URL!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/node-mssql'; 15 | 16 | // You can specify any property from the node-mssql connection options 17 | const db = drizzle({ 18 | connection: { 19 | connectionString: process.env.DATABASE_URL!, 20 | ssl: true 21 | } 22 | }); 23 | ``` 24 | ```typescript copy 25 | import { drizzle } from "drizzle-orm/node-mssql"; 26 | import type { ConnectionPool } from 'mssql'; 27 | 28 | const pool = await mssql.connect(connectionString); 29 | const db = drizzle({ client: pool }); 30 | 31 | const result = await db.execute('select 1'); 32 | ``` 33 | 34 | -------------------------------------------------------------------------------- /src/mdx/$count.mdx: -------------------------------------------------------------------------------- 1 | import Section from '@mdx/Section.astro'; 2 | 3 | `db.$count()` is a utility wrapper of `count(*)`, it is a very flexible operator which can be used as is or as a subquery, more details in our [GitHub discussion](https://github.com/drizzle-team/drizzle-orm/discussions/3119). 4 | 5 |
6 | ```ts 7 | const count = await db.$count(users); 8 | // ^? number 9 | 10 | const count = await db.$count(users, eq(users.name, "Dan")); // works with filters 11 | ``` 12 | ```sql 13 | select count(*) from "users"; 14 | select count(*) from "users" where "name" = 'Dan'; 15 | ``` 16 |
17 | 18 | It is exceptionally useful in [subqueries](/docs/select#select-from-subquery): 19 | 20 | ```ts 21 | const users = await db.select({ 22 | ...users, 23 | postsCount: db.$count(posts, eq(posts.authorId, users.id)), 24 | }).from(users); 25 | ``` 26 | 27 | usage example with [relational queries](/docs/rqb) 28 | ```ts 29 | const users = await db.query.users.findMany({ 30 | extras: { 31 | postsCount: db.$count(posts, eq(posts.authorId, users.id)), 32 | }, 33 | }); 34 | ``` 35 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectPostgreSQL.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | Create a `index.ts` file in the `src` directory and initialize the connection: 4 | 5 | 6 | ```typescript copy 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/node-postgres'; 9 | 10 | const db = drizzle(process.env.DATABASE_URL!); 11 | ``` 12 | ```typescript copy 13 | import 'dotenv/config'; 14 | import { drizzle } from 'drizzle-orm/node-postgres'; 15 | 16 | // You can specify any property from the node-postgres connection options 17 | const db = drizzle({ 18 | connection: { 19 | connectionString: process.env.DATABASE_URL!, 20 | ssl: true 21 | } 22 | }); 23 | ``` 24 | ```typescript copy 25 | import 'dotenv/config'; 26 | import { drizzle } from "drizzle-orm/node-postgres"; 27 | import { Pool } from "pg"; 28 | 29 | const pool = new Pool({ 30 | connectionString: process.env.DATABASE_URL!, 31 | }); 32 | const db = drizzle({ client: pool }); 33 | ``` 34 | 35 | -------------------------------------------------------------------------------- /src/pages/roadmap.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import * as roadmap from "@/data/roadmap.md"; 3 | import CenteredLayout from "@/ui/CenteredLayout.astro"; 4 | --- 5 | 6 | 7 |
8 |
9 |
10 | 37 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /public/svg/gibsonai-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /public/svg/gibsonai-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0302.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.2 release 3 | pubDate: 2024-03-14 4 | description: Updated LibSQL migrations to utilize batch execution instead of transactions and fixed findFirst query for bun:sqlite. 5 | --- 6 | 7 | ## Improvements 8 | 9 | LibSQL migrations have been updated to utilize batch execution instead of transactions. As stated in the [documentation](https://docs.turso.tech/sdk/ts/reference#batch-transactions), LibSQL now supports batch operations 10 | 11 | > A batch consists of multiple SQL statements executed sequentially within an implicit transaction. The backend handles the transaction: success commits all changes, while any failure results in a full rollback with no modifications. 12 | 13 | To get started with Turso and Drizzle follow the [documentation](/docs/get-started-sqlite#turso) 14 | 15 | ## Fixes 16 | 17 | - [Sqlite] Fix findFirst query for bun:sqlite ([#1885](https://github.com/drizzle-team/drizzle-orm/pull/1885)) 18 | 19 | To get started with Bun SQLite and Drizzle follow the [documentation](/docs/get-started-sqlite#bun-sqlite) 20 | -------------------------------------------------------------------------------- /src/assets/icons/DrizzleLogo.tsx: -------------------------------------------------------------------------------- 1 | const DrizzleLogo = () => ( 2 | 9 | 16 | 23 | 30 | 37 | 38 | ); 39 | 40 | export default DrizzleLogo; 41 | -------------------------------------------------------------------------------- /public/svg/new-turso.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /public/svg/edb_logo_small.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /public/svg/new-turso-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0282.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.28.2 release 3 | pubDate: 2023-08-10 4 | description: Added a set of tests for d1, fixed issues in internal documentation, resolved the issue of truncating timestamp milliseconds for MySQL, corrected the type of the '.get()' method for sqlite-based dialects, rectified the sqlite-proxy bug that caused the query to execute twice. Added a support for Typebox package. 5 | --- 6 | 7 | ## The community contributions release 🎉 8 | 9 | ### Internal Features and Changes 10 | - Added a set of tests for d1 11 | - Fixed issues in internal documentation 12 | 13 | ### Fixes 14 | - Resolved the issue of truncating timestamp milliseconds for MySQL 15 | - Corrected the type of the `.get()` method for sqlite-based dialects ([#565](https://github.com/drizzle-team/drizzle-orm/issues/565)) 16 | - Rectified the sqlite-proxy bug that caused the query to execute twice 17 | 18 | ### New packages 🎉 19 | 20 | Added a support for [Typebox](https://github.com/sinclairzx81/typebox) in [drizzle-typebox](/docs/typebox) package. 21 | 22 | Please check documentation page for more usage examples: /docs/typebox 23 | -------------------------------------------------------------------------------- /public/svg/drizzle-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /public/svg/supabase.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /public/svg/drizzle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/mdx/DriversExamples.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro" 2 | 3 | 4 | ```ts {6} 5 | import { defineConfig } from "drizzle-kit"; 6 | 7 | export default defineConfig({ 8 | dialect: "postgresql", 9 | schema: "./src/schema.ts", 10 | driver: "aws-data-api", 11 | dbCredentials: { 12 | database: "database", 13 | resourceArn: "resourceArn", 14 | secretArn: "secretArn", 15 | }, 16 | }); 17 | ``` 18 | ```ts {6} 19 | import { defineConfig } from "drizzle-kit"; 20 | 21 | export default defineConfig({ 22 | dialect: "postgresql", 23 | schema: "./src/schema.ts", 24 | driver: "pglite", 25 | dbCredentials: { 26 | // inmemory 27 | url: ":memory:" 28 | 29 | // or database folder 30 | url: "./database/" 31 | }, 32 | }); 33 | ``` 34 | ```ts {6} 35 | import { defineConfig } from "drizzle-kit"; 36 | 37 | export default defineConfig({ 38 | dialect: "sqlite", 39 | schema: "./src/schema.ts", 40 | driver: "d1-http", 41 | dbCredentials: { 42 | accountId: "accountId", 43 | databaseId: "databaseId", 44 | token: "token", 45 | }, 46 | }); 47 | ``` 48 | -------------------------------------------------------------------------------- /public/svg/nuxt-green.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /public/svg/gel_logo_letters.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /public/svg/clerk-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/assets/icons/OptionsIcon.tsx: -------------------------------------------------------------------------------- 1 | const OptionsIcon = () => ( 2 | 14 | 15 | 16 | 17 | ); 18 | 19 | export default OptionsIcon; 20 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0306.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.6 release 3 | pubDate: 2024-03-28 4 | description: Added support for PGlite driver. 5 | --- 6 | 7 | ## New Features 8 | 9 | ### PGlite driver Support 10 | 11 | [PGlite](https://github.com/electric-sql/pglite) is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 2.6mb gzipped. 12 | 13 | It can be used as an ephemeral in-memory database, or with persistence either to the file system (Node/Bun) or indexedDB (Browser). 14 | 15 | Unlike previous "Postgres in the browser" projects, PGlite does not use a Linux virtual machine - it is simply Postgres in WASM. 16 | 17 | 18 | Read get started with Drizzle and PGlite guide [here](/docs/get-started-postgresql#pglite). 19 | 20 | Usage Example 21 | ```ts copy {1,6} 22 | import { PGlite } from '@electric-sql/pglite'; 23 | import { drizzle } from 'drizzle-orm/pglite'; 24 | import { users } from './schema'; 25 | 26 | // In-memory Postgres 27 | const client = new PGlite(); 28 | const db = drizzle(client); 29 | 30 | await db.select().from(users); 31 | ``` 32 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/JoinsSelector/JoinsSelector.tsx: -------------------------------------------------------------------------------- 1 | import React, { type FC } from "react"; 2 | 3 | import styles from "./JoinsSelector.module.css"; 4 | import { useBenchmarkContext } from "@components/landing/benchmark/context/useBenchmarkContext"; 5 | 6 | interface Item { 7 | value: boolean; 8 | name: string; 9 | } 10 | 11 | const JoinsSelector: FC = () => { 12 | const { selectedItems, setSelectedItems } = useBenchmarkContext(); 13 | 14 | const items: Item[] = [ 15 | { value: false, name: "Queries" }, 16 | { value: true, name: "Joins" }, 17 | ]; 18 | 19 | const handleChange: React.ChangeEventHandler = (e) => { 20 | setSelectedItems({ 21 | ...selectedItems, 22 | joins: e.target.value === "true", 23 | }); 24 | }; 25 | 26 | return ( 27 | 41 | ); 42 | }; 43 | 44 | export default JoinsSelector; 45 | -------------------------------------------------------------------------------- /public/svg/clerk-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /public/svg/payload-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0285.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.28.5 release 3 | pubDate: 2023-08-24 12:00:00 4 | description: Fixed incorrect OpenTelemetry type import that caused a runtime error. 5 | --- 6 | 7 | ## Fixes 8 | 9 | - Fixed incorrect OpenTelemetry type import that caused a runtime error 10 | 11 | The OpenTelemetry logic currently present in the ORM isn't meant to be used by Drizzle and no stats have ever been collected by Drizzle using drizzle-orm. OpenTelemetry is simply a protocol. If you take a look at the actual code that utilizes it in drizzle-orm, it simply uses the tracer to collect the query stats and doesn't send it anywhere. It was designed for the ORM users to be able to send those stats to their own telemetry consumers. 12 | 13 | The important thing is - the OpenTelemetry logic is disabled on the current version. It literally does nothing. We experimented with it at some point in the past, but disabled it before the release. 14 | 15 | As to the reason of the issue in the last release: it happened because of an incorrect type import on [this line](https://github.com/drizzle-team/drizzle-orm/blob/594e96538e588fee5748e372884dbaf32c331524/drizzle-orm/src/tracing.ts#L1). We've used `import { type ... }` syntax instead of `import type { ... }`, which resulted in the `import '@opentelemetry/api'` line leaking to the runtime. 16 | -------------------------------------------------------------------------------- /src/ui/components/Banner.astro: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /public/svg/payload.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0309.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.9 release 3 | pubDate: 2024-04-22 4 | description: Added 'setWhere' and 'targetWhere' fields to '.onConflictDoUpdate()' config in SQLite, added schema information to Drizzle instances via 'db._.fullSchema' and fixed migrator in AWS Data API. 5 | --- 6 | 7 | ## New Features 8 | 9 | - Added `setWhere` and `targetWhere` fields to `.onConflictDoUpdate()` config in SQLite instead of single `where` field: 10 | 11 | ```ts copy 12 | await db.insert(employees) 13 | .values({ employeeId: 123, name: 'John Doe' }) 14 | .onConflictDoUpdate({ 15 | target: employees.employeeId, 16 | targetWhere: sql`name <> 'John Doe'`, 17 | set: { name: sql`excluded.name` } 18 | }); 19 | 20 | await db.insert(employees) 21 | .values({ employeeId: 123, name: 'John Doe' }) 22 | .onConflictDoUpdate({ 23 | target: employees.employeeId, 24 | set: { name: 'John Doe' }, 25 | setWhere: sql`name <> 'John Doe'` 26 | }); 27 | ``` 28 | 29 | Read more about `.onConflictDoUpdate()` method [here](/docs/insert#on-conflict-do-update). 30 | 31 | - 🛠️ Added schema information to Drizzle instances via `db._.fullSchema` 32 | 33 | ## Fixes 34 | 35 | - Fixed migrator in AWS Data API 36 | 37 | To get started with Drizzle and AWS Data API follow the [documentation](/docs/get-started-postgresql#aws-data-api). 38 | -------------------------------------------------------------------------------- /src/mdx/get-started/QueryDatabaseUpdated.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | 4 | ```typescript copy filename="src/index.ts" 5 | import 'dotenv/config'; 6 | import { drizzle } from 'drizzle-orm/$dialect$'; 7 | import { eq } from 'drizzle-orm'; 8 | import { usersTable } from './db/schema'; 9 | 10 | const db = drizzle(process.env.$env_variable$!); 11 | 12 | async function main() { 13 | const user: typeof usersTable.$inferInsert = { 14 | name: 'John', 15 | age: 30, 16 | email: 'john@example.com', 17 | phone: '123-456-7890', 18 | }; 19 | 20 | await db.insert(usersTable).values(user); 21 | console.log('New user created!') 22 | 23 | const users = await db.select().from(usersTable); 24 | console.log('Getting all users from the database: ', users) 25 | /* 26 | const users: { 27 | id: number; 28 | name: string; 29 | age: number; 30 | email: string; 31 | phone: string | null; 32 | }[] 33 | */ 34 | 35 | await db 36 | .update(usersTable) 37 | .set({ 38 | age: 31, 39 | }) 40 | .where(eq(usersTable.email, user.email)); 41 | console.log('User info updated!') 42 | 43 | await db.delete(usersTable).where(eq(usersTable.email, user.email)); 44 | console.log('User deleted!') 45 | } 46 | 47 | main(); 48 | ``` 49 | -------------------------------------------------------------------------------- /src/content/docs/guides/toggling-a-boolean-field.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: SQL Toggle value 3 | slug: toggling-a-boolean-field 4 | --- 5 | import Section from "@mdx/Section.astro"; 6 | import IsSupportedChipGroup from "@mdx/IsSupportedChipGroup.astro"; 7 | import Prerequisites from "@mdx/Prerequisites.astro"; 8 | 9 | 10 | 11 | 12 | - Get started with [PostgreSQL](/docs/get-started-postgresql), [MySQL](/docs/get-started-mysql) and [SQLite](/docs/get-started-sqlite) 13 | - [Update statement](/docs/update) 14 | - [Filters](/docs/operators) and [not operator](/docs/operators#not) 15 | - Boolean data type in [MySQL](/docs/column-types/mysql#boolean) and [SQLite](/docs/column-types/sqlite#boolean) 16 | 17 | 18 | To toggle a column value you can use `update().set()` method like below: 19 | 20 |
21 | ```tsx copy {8} 22 | import { eq, not } from 'drizzle-orm'; 23 | 24 | const db = drizzle(...); 25 | 26 | await db 27 | .update(table) 28 | .set({ 29 | isActive: not(table.isActive), 30 | }) 31 | .where(eq(table.id, 1)); 32 | ``` 33 | 34 | ```sql 35 | update "table" set "is_active" = not "is_active" where "id" = 1; 36 | ``` 37 |
38 | 39 | Please note that there is no boolean type in MySQL and SQLite. 40 | MySQL uses tinyint(1). 41 | SQLite uses integers 0 (false) and 1 (true). 42 | -------------------------------------------------------------------------------- /src/mdx/get-started/QueryDatabase.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | Let's **update** the `src/index.ts` file with queries to create, read, update, and delete users 4 | 5 | 6 | ```typescript copy filename="src/index.ts" 7 | import 'dotenv/config'; 8 | import { drizzle } from 'drizzle-orm/$dialect$'; 9 | import { eq } from 'drizzle-orm'; 10 | import { usersTable } from './db/schema'; 11 | 12 | const db = drizzle(process.env.$env_variable$!); 13 | 14 | async function main() { 15 | const user: typeof usersTable.$inferInsert = { 16 | name: 'John', 17 | age: 30, 18 | email: 'john@example.com', 19 | }; 20 | 21 | await db.insert(usersTable).values(user); 22 | console.log('New user created!') 23 | 24 | const users = await db.select().from(usersTable); 25 | console.log('Getting all users from the database: ', users) 26 | /* 27 | const users: { 28 | id: number; 29 | name: string; 30 | age: number; 31 | email: string; 32 | }[] 33 | */ 34 | 35 | await db 36 | .update(usersTable) 37 | .set({ 38 | age: 31, 39 | }) 40 | .where(eq(usersTable.email, user.email)); 41 | console.log('User info updated!') 42 | 43 | await db.delete(usersTable).where(eq(usersTable.email, user.email)); 44 | console.log('User deleted!') 45 | } 46 | 47 | main(); 48 | ``` 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 🚀 Project Structure 2 | 3 | MDX files are located in this folder: 4 | 5 | ```text 6 | ├── src/ 7 | │ ├── content/ 8 | │ │ └── docs 9 | ``` 10 | 11 | Announcements markdown files: 12 | 13 | ```text 14 | ├── src/ 15 | │ ├──data/ 16 | │ │ └── announcements 17 | ``` 18 | 19 | Roadmap markdown file: 20 | 21 | ```text 22 | ├── src/ 23 | │ ├──data/ 24 | │ │ └── roadmap.md 25 | ``` 26 | 27 | Shipping section yaml file: 28 | 29 | ```text 30 | ├── src/ 31 | │ ├──data/ 32 | │ │ └── shipping.yaml 33 | ``` 34 | 35 | ``` 36 | progress: number 37 | weeks: 38 | - date: 39 | start: "YYYY-MM-DD" 40 | details: 41 | - string 42 | ``` 43 | 44 | 45 | ## 🧞 Commands 46 | 47 | All commands are run from the root of the project, from a terminal: 48 | 49 | | Command | Action | 50 | | :------------------------ | :----------------------------------------------- | 51 | | `pnpm install` | Installs dependencies | 52 | | `pnpm run dev` | Starts local dev server at `localhost:4321` | 53 | | `pnpm run build` | Build your production site to `./dist/` | 54 | | `pnpm run preview` | Preview your build locally, before deploying | 55 | | `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` | 56 | | `pnpm run astro -- --help` | Get help using the Astro CLI | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0305.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.5 release 3 | pubDate: 2024-03-27 4 | description: Added '$onUpdate' functionality for PostgreSQL, MySQL and SQLite and fixed insertions on columns with the smallserial datatype. 5 | --- 6 | 7 | ## New Features 8 | 9 | ### `$onUpdate` functionality for PostgreSQL, MySQL and SQLite 10 | 11 | Adds a dynamic update value to the column. 12 | The function will be called when the row is updated, and the returned value will be used as the column value if none is provided. 13 | If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value. 14 | 15 | > Note: This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`. 16 | 17 | ```ts copy {4,5,6} 18 | const usersOnUpdate = pgTable('users_on_update', { 19 | id: serial('id').primaryKey(), 20 | name: text('name').notNull(), 21 | updateCounter: integer('update_counter').default(sql`1`).$onUpdateFn(() => sql`update_counter + 1`), 22 | updatedAt: timestamp('updated_at', { mode: 'date', precision: 3 }).$onUpdate(() => new Date()), 23 | alwaysNull: text('always_null').$type().$onUpdate(() => null), 24 | }); 25 | ``` 26 | 27 | ## Fixes 28 | 29 | - Insertions on columns with the smallserial datatype are not optional - [#1848](https://github.com/drizzle-team/drizzle-orm/issues/1848) 30 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:react/recommended", 9 | "plugin:prettier/recommended", 10 | "plugin:jsx-a11y/recommended", 11 | "plugin:react-hooks/recommended", 12 | "plugin:@typescript-eslint/recommended", 13 | "plugin:@typescript-eslint/recommended-requiring-type-checking" 14 | ], 15 | "overrides": [], 16 | "parser": "@typescript-eslint/parser", 17 | "parserOptions": { 18 | "ecmaFeatures": { 19 | "jsx": true 20 | }, 21 | "ecmaVersion": "latest", 22 | "sourceType": "module", 23 | "project": "./tsconfig.json" 24 | }, 25 | "plugins": [ 26 | "react", 27 | "react-refresh", 28 | "@typescript-eslint", 29 | "import", 30 | "jsx-a11y", 31 | "react-hooks", 32 | "prettier" 33 | ], 34 | "rules": { 35 | "react/react-in-jsx-scope": "off", 36 | "prettier/prettier": "error", 37 | "react/prop-types": "off", 38 | "react/display-name": "off", 39 | "jsx-a11y/img-redundant-alt": "off", 40 | "react-refresh/only-export-components": "warn", 41 | "@typescript-eslint/no-misused-promises": "off", 42 | "jsx-a11y/no-static-element-interactions": "off", 43 | "jsx-a11y/click-events-have-key-events": "off", 44 | "@typescript-eslint/no-unsafe-call": "off", 45 | "@typescript-eslint/no-unsafe-assignment": "off", 46 | "@typescript-eslint/no-explicit-any": "off", 47 | "@typescript-eslint/no-unsafe-member-access": "off" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/content/docs/latest-releases/drizzle-orm-v0304.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DrizzleORM v0.30.4 release 3 | pubDate: 2024-03-19 12:00:00 4 | description: Added support for Xata driver. 5 | --- 6 | 7 | import Npm from "@mdx/Npm.astro"; 8 | 9 | ## New Features 10 | 11 | ### 🎉 xata-http driver support 12 | 13 | According their **[official website](https://xata.io)**, Xata is a Postgres data platform with a focus on reliability, scalability, and developer experience. The Xata Postgres service is currently in beta, please see the [Xata docs](https://xata.io/docs/postgres) on how to enable it in your account. 14 | 15 | Drizzle ORM natively supports both the `xata` driver with `drizzle-orm/xata` package and the **`postgres`** or **`pg`** drivers for accessing a Xata Postgres database. 16 | 17 | The following example use the Xata generated client, which you obtain by running the [xata init](https://xata.io/docs/getting-started/installation) CLI command. 18 | 19 | 20 | drizzle-orm @xata.io/client 21 | -D drizzle-kit 22 | 23 | 24 | ```ts 25 | import { drizzle } from 'drizzle-orm/xata-http'; 26 | import { getXataClient } from './xata'; // Generated client 27 | 28 | const xata = getXataClient(); 29 | const db = drizzle(xata); 30 | 31 | const result = await db.select().from(...); 32 | ``` 33 | 34 | You can also connect to Xata using `pg` or `postgres.js` drivers 35 | 36 | To get started with Xata and Drizzle follow the [documentation](/docs/get-started-postgresql#xata). 37 | -------------------------------------------------------------------------------- /src/mdx/get-started/mysql/QueryPlanetScale.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | Let's **update** the `src/index.ts` file with queries to create, read, update, and delete users 4 | 5 | ```typescript copy filename="src/index.ts" 6 | import 'dotenv/config'; 7 | import { eq } from 'drizzle-orm'; 8 | import { drizzle } from 'drizzle-orm/planetscale-serverless'; 9 | import { usersTable } from './db/schema'; 10 | 11 | const db = drizzle({ connection: { 12 | host: process.env.DATABASE_HOST!, 13 | username: process.env.DATABASE_USERNAME!, 14 | password: process.env.DATABASE_PASSWORD!, 15 | }}); 16 | 17 | async function main() { 18 | const user: typeof usersTable.$inferInsert = { 19 | name: 'John', 20 | age: 30, 21 | email: 'john@example.com', 22 | }; 23 | 24 | await db.insert(usersTable).values(user); 25 | console.log('New user created!') 26 | 27 | const users = await db.select().from(usersTable); 28 | console.log('Getting all users from the database: ', users) 29 | /* 30 | const users: { 31 | id: number; 32 | name: string; 33 | age: number; 34 | email: string; 35 | }[] 36 | */ 37 | 38 | await db 39 | .update(usersTable) 40 | .set({ 41 | age: 31, 42 | }) 43 | .where(eq(usersTable.email, user.email)); 44 | console.log('User info updated!') 45 | 46 | await db.delete(usersTable).where(eq(usersTable.email, user.email)); 47 | console.log('User deleted!') 48 | } 49 | 50 | main(); 51 | ``` -------------------------------------------------------------------------------- /src/pages/[...slug].astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { getCollection } from 'astro:content'; 3 | 4 | import Link from '@mdx/Link.astro'; 5 | import CustomHeader from '@components/CustomHeader.astro'; 6 | import DocsLayout from '@/ui/DocsLayout.astro'; 7 | 8 | export async function getStaticPaths() { 9 | const metaFiles = import.meta.glob('../content/**/*.json'); 10 | const slugs: string[] = []; 11 | const regex = /\.\.\/content\/(.*?)\/_meta\.json/; 12 | 13 | for(const meta in metaFiles) { 14 | const {default: parsed} = await metaFiles[meta]() as {default: string[]}; 15 | 16 | const metaSlug = meta.match(regex); 17 | if (metaSlug) { 18 | const extractedText = metaSlug[1]; 19 | 20 | parsed.forEach((key) => { 21 | if(Array.isArray(key)) { 22 | slugs.push(`${extractedText}/${key[0]}`); 23 | } 24 | }) 25 | } 26 | } 27 | 28 | const docEntries = await getCollection("docs", (entry) => { 29 | return slugs.includes(`docs/${entry.slug}`); 30 | }); 31 | return docEntries.map(entry => ({ 32 | params: { slug: `docs/${entry.slug}` }, props: { entry, frontmatter: entry.data }, 33 | })); 34 | } 35 | 36 | const { entry, frontmatter } = Astro.props; 37 | 38 | const { Content, headings } = await entry.render(); 39 | 40 | --- 41 | 42 | {frontmatter?.title && {frontmatter.title}} 43 | 44 | -------------------------------------------------------------------------------- /src/mdx/LibsqlTabs.mdx: -------------------------------------------------------------------------------- 1 | import CodeTabs from "@mdx/CodeTabs.astro"; 2 | 3 | 4 | ```typescript copy 5 | import { drizzle } from 'drizzle-orm/libsql'; 6 | 7 | const db = drizzle({ connection: { 8 | url: process.env.DATABASE_URL, 9 | authToken: process.env.DATABASE_AUTH_TOKEN 10 | }}); 11 | ``` 12 | ```typescript copy 13 | import { drizzle } from 'drizzle-orm/libsql/node'; 14 | 15 | const db = drizzle({ connection: { 16 | url: process.env.DATABASE_URL, 17 | authToken: process.env.DATABASE_AUTH_TOKEN 18 | }}); 19 | ``` 20 | ```typescript copy 21 | import { drizzle } from 'drizzle-orm/libsql/web'; 22 | 23 | const db = drizzle({ connection: { 24 | url: process.env.DATABASE_URL, 25 | authToken: process.env.DATABASE_AUTH_TOKEN 26 | }}); 27 | ``` 28 | ```typescript copy 29 | import { drizzle } from 'drizzle-orm/libsql/http'; 30 | 31 | const db = drizzle({ connection: { 32 | url: process.env.DATABASE_URL, 33 | authToken: process.env.DATABASE_AUTH_TOKEN 34 | }}); 35 | ``` 36 | ```typescript copy 37 | import { drizzle } from 'drizzle-orm/libsql/ws'; 38 | 39 | const db = drizzle({ connection: { 40 | url: process.env.DATABASE_URL, 41 | authToken: process.env.DATABASE_AUTH_TOKEN 42 | }}); 43 | ``` 44 | ```typescript copy 45 | import { drizzle } from 'drizzle-orm/libsql/wasm'; 46 | 47 | const db = drizzle({ connection: { 48 | url: process.env.DATABASE_URL, 49 | authToken: process.env.DATABASE_AUTH_TOKEN 50 | }}); 51 | ``` 52 | -------------------------------------------------------------------------------- /src/mdx/LibsqlTable.mdx: -------------------------------------------------------------------------------- 1 | | | | 2 | | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | 3 | | `@libsql/client` | defaults to `node` import, automatically changes to `web` if `target` or `platform` is set for bundler, e.g. `esbuild --platform=browser` | 4 | | `@libsql/client/node` | `node` compatible module, supports `:memory:`, `file`, `wss`, `http` and `turso` connection protocols | 5 | | `@libsql/client/web` | module for fullstack web frameworks like `next`, `nuxt`, `astro`, etc. | 6 | | `@libsql/client/http` | module for `http` and `https` connection protocols | 7 | | `@libsql/client/ws` | module for `ws` and `wss` connection protocols | 8 | | `@libsql/client/sqlite3` | module for `:memory:` and `file` connection protocols | 9 | | `@libsql/client-wasm` | Separate experimental package for WASM | 10 | -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/QueryTurso.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | Let's **update** the `src/index.ts` file with queries to create, read, update, and delete users 4 | 5 | 6 | ```typescript copy filename="src/index.ts" 7 | import 'dotenv/config'; 8 | import { eq } from 'drizzle-orm'; 9 | import { drizzle } from 'drizzle-orm/libsql'; 10 | import { usersTable } from './db/schema'; 11 | 12 | async function main() { 13 | const db = drizzle({ 14 | connection: { 15 | url: process.env.TURSO_DATABASE_URL!, 16 | authToken: process.env.TURSO_AUTH_TOKEN! 17 | } 18 | }); 19 | 20 | const user: typeof usersTable.$inferInsert = { 21 | name: 'John', 22 | age: 30, 23 | email: 'john@example.com', 24 | }; 25 | 26 | await db.insert(usersTable).values(user); 27 | console.log('New user created!') 28 | 29 | const users = await db.select().from(usersTable); 30 | console.log('Getting all users from the database: ', users) 31 | /* 32 | const users: { 33 | id: number; 34 | name: string; 35 | age: number; 36 | email: string; 37 | }[] 38 | */ 39 | 40 | await db 41 | .update(usersTable) 42 | .set({ 43 | age: 31, 44 | }) 45 | .where(eq(usersTable.email, user.email)); 46 | console.log('User info updated!') 47 | 48 | await db.delete(usersTable).where(eq(usersTable.email, user.email)); 49 | console.log('User deleted!') 50 | } 51 | 52 | main(); 53 | ``` 54 | -------------------------------------------------------------------------------- /src/mdx/get-started/mssql/IntrospectMSSQL.mdx: -------------------------------------------------------------------------------- 1 | Drizzle Kit provides a CLI command to introspect your database and generate a schema file with migrations. The schema file contains all the information about your database tables, columns, relations, and indices. 2 | 3 | For example, you have such table in your database: 4 | 5 | ```sql copy 6 | CREATE TABLE [users] ( 7 | [id] int, 8 | [name] varchar(255) NOT NULL, 9 | [age] int NOT NULL, 10 | [email] varchar(255) NOT NULL, 11 | CONSTRAINT [users_pkey] PRIMARY KEY([id]), 12 | CONSTRAINT [users_email_key] UNIQUE([email]) 13 | ); 14 | ``` 15 | 16 | Pull your database schema: 17 | 18 | ```bash copy 19 | npx drizzle-kit pull --init 20 | ``` 21 | 22 | The result of introspection will be a `schema.ts` file, `meta` folder with snapshots of your database schema, sql file with the migration and `relations.ts` file for [relational queries](/docs/rqb). 23 | 24 | Here is an example of the generated `schema.ts` file: 25 | 26 | ```typescript copy filename="src/db/schema.ts" 27 | // table schema generated by introspection 28 | import { mssqlTable, int, varchar, unique, primaryKey } from "drizzle-orm/mssql-core" 29 | 30 | export const users = mssqlTable("users", { 31 | id: int(), 32 | name: varchar({ length: 255 }).notNull(), 33 | age: int().notNull(), 34 | email: varchar({ length: 255 }).notNull(), 35 | }, (table) => [ 36 | primaryKey({ columns: [table.id], name: "users_pkey"}), 37 | unique("users_email_key").on(table.email) 38 | ]); 39 | ``` 40 | 41 | Learn more about introspection in the [documentation](/docs/drizzle-kit-pull). 42 | -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/IntrospectSqlite.mdx: -------------------------------------------------------------------------------- 1 | Drizzle Kit provides a CLI command to introspect your database and generate a schema file with migrations. The schema file contains all the information about your database tables, columns, relations, and indices. 2 | 3 | For example, you have such table in your database: 4 | 5 | ```sql copy 6 | CREATE TABLE `users_table` ( 7 | `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, 8 | `name` text NOT NULL, 9 | `age` integer NOT NULL, 10 | `email` text NOT NULL UNIQUE 11 | ); 12 | ``` 13 | 14 | Pull your database schema: 15 | 16 | ```bash copy 17 | npx drizzle-kit pull --init 18 | ``` 19 | 20 | The result of introspection will be a `schema.ts` file, `meta` folder with snapshots of your database schema, 21 | sql file with the migration and `relations.ts` file for [relational queries](/docs/rqb). 22 | 23 | Here is an example of the generated `schema.ts` file: 24 | 25 | ```typescript copy filename="drizzle/schema.ts" 26 | // table schema generated by introspection 27 | import { 28 | sqliteTable, 29 | uniqueIndex, 30 | integer, 31 | text, 32 | } from "drizzle-orm/sqlite-core"; 33 | 34 | export const usersTable = sqliteTable( 35 | "users_table", 36 | { 37 | id: integer().primaryKey({ autoIncrement: true }).notNull(), 38 | name: text().notNull(), 39 | age: integer().notNull(), 40 | email: text().notNull(), 41 | }, 42 | (table) => [ 43 | uniqueIndex("users_table_email_unique").on(table.email) 44 | ] 45 | ); 46 | ``` 47 | 48 | Learn more about introspection in the [documentation](/docs/drizzle-kit-pull). -------------------------------------------------------------------------------- /src/data/sponsor-config.ts: -------------------------------------------------------------------------------- 1 | export const sponsorConfig: { 2 | [key: string]: { 3 | header: string; 4 | size: number; 5 | emoji: string; 6 | hasCard: boolean; 7 | hasName: boolean; 8 | columnSize: number; 9 | rowSize: number; 10 | }; 11 | } = { 12 | hero: { 13 | header: "Hero", 14 | emoji: "🦸", 15 | size: 84, 16 | hasName: true, 17 | hasCard: true, 18 | columnSize: 110, 19 | rowSize: 134, 20 | }, 21 | gold: { 22 | header: "Gold", 23 | emoji: "🥇", 24 | size: 70, 25 | hasName: true, 26 | hasCard: true, 27 | columnSize: 110, 28 | rowSize: 134, 29 | }, 30 | silver: { 31 | header: "Silver", 32 | emoji: "🥈", 33 | size: 50, 34 | hasName: true, 35 | hasCard: false, 36 | columnSize: 110, 37 | rowSize: 134, 38 | }, 39 | bronze: { 40 | header: "Bronze", 41 | emoji: "🥉", 42 | size: 42, 43 | hasName: false, 44 | hasCard: false, 45 | columnSize: 110, 46 | rowSize: 134, 47 | }, 48 | ramen: { 49 | header: "Ramen", 50 | emoji: "🍜", 51 | size: 38, 52 | hasName: false, 53 | hasCard: false, 54 | columnSize: 110, 55 | rowSize: 134, 56 | }, 57 | coffee: { 58 | header: "Coffee", 59 | emoji: "☕️", 60 | size: 35, 61 | hasName: false, 62 | hasCard: false, 63 | columnSize: 110, 64 | rowSize: 134, 65 | }, 66 | past: { 67 | header: "Past", 68 | emoji: "🕣", 69 | size: 25, 70 | hasName: false, 71 | hasCard: false, 72 | columnSize: 110, 73 | rowSize: 134, 74 | }, 75 | }; 76 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectSupabase.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | 3 | Create a `index.ts` file in the `src` directory and initialize the connection: 4 | 5 | ```typescript copy filename="index.ts" 6 | import { drizzle } from 'drizzle-orm' 7 | 8 | async function main() { 9 | const db = drizzle('postgres-js', process.env.DATABASE_URL); 10 | } 11 | 12 | main(); 13 | ``` 14 | If you need a synchronous connection, you can use our additional connection API, 15 | where you specify a driver connection and pass it to the Drizzle instance. 16 | 17 | ```typescript copy filename="index.ts" 18 | import { drizzle } from 'drizzle-orm/postgres-js' 19 | import postgres from 'postgres' 20 | 21 | async function main() { 22 | const client = postgres(process.env.DATABASE_URL) 23 | const db = drizzle({ client }); 24 | } 25 | 26 | main(); 27 | ``` 28 | 29 | 30 | If you decide to use connection pooling via Supabase (described [here](https://supabase.com/docs/guides/database/connecting-to-postgres#connection-pooler)), and have "Transaction" pool mode enabled, then ensure to turn off prepare, as prepared statements are not supported. 31 | 32 | ```typescript copy filename="index.ts" 33 | import { drizzle } from 'drizzle-orm/postgres-js' 34 | import postgres from 'postgres' 35 | 36 | async function main() { 37 | // Disable prefetch as it is not supported for "Transaction" pool mode 38 | const client = postgres(process.env.DATABASE_URL, { prepare: false }) 39 | const db = drizzle({ client }); 40 | } 41 | 42 | main(); 43 | ``` 44 | -------------------------------------------------------------------------------- /src/mdx/get-started/sqlite/QueryTursoUpdated.mdx: -------------------------------------------------------------------------------- 1 | import CodeWithProps from "@mdx/CodeWithProps.astro"; 2 | 3 | Let's **update** the `src/index.ts` file with queries to create, read, update, and delete users 4 | 5 | 6 | ```typescript copy filename="src/index.ts" 7 | import 'dotenv/config'; 8 | import { eq } from 'drizzle-orm'; 9 | import { drizzle } from 'drizzle-orm/libsql'; 10 | import { usersTable } from './db/schema'; 11 | 12 | async function main() { 13 | const db = drizzle({ 14 | connection: { 15 | url: process.env.TURSO_DATABASE_URL!, 16 | authToken: process.env.TURSO_AUTH_TOKEN! 17 | } 18 | }); 19 | 20 | const user: typeof usersTable.$inferInsert = { 21 | name: 'John', 22 | age: 30, 23 | email: 'john@example.com', 24 | phone: '123-456-7890', 25 | }; 26 | 27 | await db.insert(usersTable).values(user); 28 | console.log('New user created!') 29 | 30 | const users = await db.select().from(usersTable); 31 | console.log('Getting all users from the database: ', users) 32 | /* 33 | const users: { 34 | id: number; 35 | name: string; 36 | age: number; 37 | email: string; 38 | phone: string | null; 39 | }[] 40 | */ 41 | 42 | await db 43 | .update(usersTable) 44 | .set({ 45 | age: 31, 46 | }) 47 | .where(eq(usersTable.email, user.email)); 48 | console.log('User info updated!') 49 | 50 | await db.delete(usersTable).where(eq(usersTable.email, user.email)); 51 | console.log('User deleted!') 52 | } 53 | 54 | main(); 55 | ``` 56 | -------------------------------------------------------------------------------- /src/content/docs/connect-bun-sql.mdx: -------------------------------------------------------------------------------- 1 | import Npm from "@mdx/Npm.astro"; 2 | import Callout from '@mdx/Callout.astro'; 3 | import AnchorCards from '@mdx/AnchorCards.astro'; 4 | import Steps from '@mdx/Steps.astro'; 5 | import WhatsNextPostgres from "@mdx/WhatsNextPostgres.astro"; 6 | import Prerequisites from "@mdx/Prerequisites.astro"; 7 | import CodeTabs from "@mdx/CodeTabs.astro"; 8 | 9 | # Drizzle \<\> Bun SQL 10 | 11 | 12 | - Database [connection basics](/docs/connect-overview) with Drizzle 13 | - Bun - [website](https://bun.sh/docs) 14 | - Bun SQL - native bindings for working with PostgreSQL databases - [read here](https://bun.sh/docs/api/sql) 15 | 16 | 17 | According to the **[official website](https://bun.sh/)**, Bun is a fast all-in-one JavaScript runtime. 18 | 19 | Drizzle ORM natively supports **[`bun sql`](https://bun.sh/docs/api/sql)** module and it's crazy fast 🚀 20 | 21 | #### Step 1 - Install packages 22 | 23 | drizzle-orm 24 | -D drizzle-kit 25 | 26 | 27 | #### Step 2 - Initialize the driver and make a query 28 | ```typescript copy 29 | import 'dotenv/config'; 30 | import { drizzle } from 'drizzle-orm/bun-sql'; 31 | 32 | const db = drizzle(process.env.DATABASE_URL); 33 | 34 | const result = await db.select().from(...); 35 | ``` 36 | 37 | If you need to provide your existing driver: 38 | ```typescript copy 39 | import 'dotenv/config'; 40 | import { drizzle } from 'drizzle-orm/bun-sql'; 41 | import { SQL } from 'bun'; 42 | 43 | const client = new SQL(process.env.DATABASE_URL!); 44 | const db = drizzle({ client }); 45 | ``` 46 | 47 | #### What's next? 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/content/docs/guides/decrementing-a-value.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: SQL Decrement value 3 | slug: decrementing-a-value 4 | --- 5 | import Section from "@mdx/Section.astro"; 6 | import IsSupportedChipGroup from "@mdx/IsSupportedChipGroup.astro"; 7 | import Prerequisites from "@mdx/Prerequisites.astro"; 8 | 9 | 10 | 11 | 12 | - Get started with [PostgreSQL](/docs/get-started-postgresql), [MySQL](/docs/get-started-mysql) and [SQLite](/docs/get-started-sqlite) 13 | - [Update statement](/docs/update) 14 | - [Filters](/docs/operators) and [sql operator](/docs/sql) 15 | 16 | 17 | To decrement a column value you can use `update().set()` method like below: 18 | 19 |
20 | ```ts copy {8} 21 | import { eq, sql } from 'drizzle-orm'; 22 | 23 | const db = drizzle(...) 24 | 25 | await db 26 | .update(table) 27 | .set({ 28 | counter: sql`${table.counter} - 1`, 29 | }) 30 | .where(eq(table.id, 1)); 31 | ``` 32 | 33 | ```sql 34 | update "table" set "counter" = "counter" - 1 where "id" = 1; 35 | ``` 36 |
37 | 38 | Drizzle has simple and flexible API, which lets you easily create custom solutions. This is how you do custom decrement function: 39 | 40 | ```ts copy {4,10,11} 41 | import { AnyColumn } from 'drizzle-orm'; 42 | 43 | const decrement = (column: AnyColumn, value = 1) => { 44 | return sql`${column} - ${value}`; 45 | }; 46 | 47 | await db 48 | .update(table) 49 | .set({ 50 | counter1: decrement(table.counter1), 51 | counter2: decrement(table.counter2, 10), 52 | }) 53 | .where(eq(table.id, 1)); 54 | ``` 55 | -------------------------------------------------------------------------------- /src/content/docs/guides/incrementing-a-value.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: SQL Increment value 3 | slug: incrementing-a-value 4 | --- 5 | import Section from "@mdx/Section.astro"; 6 | import IsSupportedChipGroup from "@mdx/IsSupportedChipGroup.astro"; 7 | import Prerequisites from "@mdx/Prerequisites.astro"; 8 | 9 | 10 | 11 | 12 | - Get started with [PostgreSQL](/docs/get-started-postgresql), [MySQL](/docs/get-started-mysql) and [SQLite](/docs/get-started-sqlite) 13 | - [Update statement](/docs/update) 14 | - [Filters](/docs/operators) and [sql operator](/docs/sql) 15 | 16 | 17 | To increment a column value you can use `update().set()` method like below: 18 | 19 |
20 | ```ts copy {8} 21 | import { eq, sql } from 'drizzle-orm'; 22 | 23 | const db = drizzle(...) 24 | 25 | await db 26 | .update(table) 27 | .set({ 28 | counter: sql`${table.counter} + 1`, 29 | }) 30 | .where(eq(table.id, 1)); 31 | ``` 32 | 33 | ```sql 34 | update "table" set "counter" = "counter" + 1 where "id" = 1; 35 | ``` 36 |
37 | 38 | Drizzle has simple and flexible API, which lets you easily create custom solutions. This is how you do custom increment function: 39 | 40 | ```ts copy {4,10,11} 41 | import { AnyColumn } from 'drizzle-orm'; 42 | 43 | const increment = (column: AnyColumn, value = 1) => { 44 | return sql`${column} + ${value}`; 45 | }; 46 | 47 | await db 48 | .update(table) 49 | .set({ 50 | counter1: increment(table.counter1), 51 | counter2: increment(table.counter2, 10), 52 | }) 53 | .where(eq(table.id, 1)); 54 | ``` 55 | -------------------------------------------------------------------------------- /src/mdx/get-started/mysql/ConnectMySQL.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | import CodeTabs from "@mdx/CodeTabs.astro"; 3 | 4 | Create a `index.ts` file in the `src/db` directory and initialize the connection: 5 | 6 | 7 | ```typescript copy 8 | import 'dotenv/config'; 9 | import { drizzle } from "drizzle-orm/mysql2"; 10 | 11 | const db = drizzle(process.env.DATABASE_URL); 12 | ``` 13 | ```typescript copy 14 | import 'dotenv/config'; 15 | import { drizzle } from "drizzle-orm/mysql2"; 16 | 17 | // You can specify any property from the mysql2 connection options 18 | const db = drizzle({ connection: { uri: process.env.DATABASE_URL }}); 19 | ``` 20 | ```ts 21 | import 'dotenv/config'; 22 | import { drizzle } from "drizzle-orm/mysql2"; 23 | import mysql from "mysql2/promise"; 24 | 25 | const poolConnection = mysql.createPool({ 26 | host: "host", 27 | user: "user", 28 | database: "database", 29 | }); 30 | const db = drizzle({ client: poolConnection }); 31 | 32 | // or if you need client connection 33 | async function main() { 34 | const connection = await mysql.createConnection({ 35 | host: "host", 36 | user: "user", 37 | database: "database", 38 | }); 39 | const db = drizzle({ client: connection }); 40 | } 41 | main(); 42 | ``` 43 | 44 | 45 | 46 | For the built in `migrate` function with DDL migrations we and drivers strongly encourage you to use single `client` connection. 47 | 48 | For querying purposes feel free to use either `client` or `pool` based on your business demands. 49 | -------------------------------------------------------------------------------- /src/mdx/get-started/singlestore/ConnectSingleStore.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | import CodeTabs from "@mdx/CodeTabs.astro"; 3 | 4 | Create a `index.ts` file in the `src/db` directory and initialize the connection: 5 | 6 | 7 | ```typescript copy 8 | import 'dotenv/config'; 9 | import { drizzle } from "drizzle-orm/singlestore"; 10 | 11 | const db = drizzle(process.env.DATABASE_URL); 12 | ``` 13 | ```typescript copy 14 | import 'dotenv/config'; 15 | import { drizzle } from "drizzle-orm/singlestore"; 16 | 17 | // You can specify any property from the mysql2 connection options 18 | const db = drizzle({ connection: { uri: process.env.DATABASE_URL }}); 19 | ``` 20 | ```ts 21 | import 'dotenv/config'; 22 | import { drizzle } from "drizzle-orm/singlestore"; 23 | import mysql from "mysql2/promise"; 24 | 25 | const poolConnection = mysql.createPool({ 26 | host: "host", 27 | user: "user", 28 | database: "database", 29 | }); 30 | const db = drizzle({ client: poolConnection }); 31 | 32 | // or if you need client connection 33 | async function main() { 34 | const connection = await mysql.createConnection({ 35 | host: "host", 36 | user: "user", 37 | database: "database", 38 | }); 39 | const db = drizzle({ client: connection }); 40 | } 41 | main(); 42 | ``` 43 | 44 | 45 | 46 | For the built in `migrate` function with DDL migrations we and drivers strongly encourage you to use single `client` connection. 47 | 48 | For querying purposes feel free to use either `client` or `pool` based on your business demands. 49 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/BenchmarkConfig/BenchmarkConfig.tsx: -------------------------------------------------------------------------------- 1 | import { type FC } from "react"; 2 | import { type IParams } from "../../types"; 3 | import configurationData from "../../configurationData"; 4 | import styles from "./BenchmarkConfig.module.css"; 5 | 6 | interface Props { 7 | selectedItems: IParams; 8 | } 9 | 10 | const BenchmarkConfig: FC = ({ selectedItems }) => ( 11 |
12 |
13 |
14 | {configurationData.orm.items[selectedItems.orm].config_info} 15 |
16 |
17 |
18 |
19 |
20 | {configurationData.dbSize.items[selectedItems.dbSize].config_info} 21 |
22 |
23 | { 24 | configurationData.projectType.items[selectedItems.projectType] 25 | .config_info 26 | } 27 |
28 |
29 | {configurationData.database.items[selectedItems.database].config_info} 30 |
31 |
32 |
33 |
34 |
Lenovo M720q
35 |
36 | Linux 5.15.0-86-generic x86_64 37 |
38 |
Intel Core i3-9100T
39 |
RAM 32GB DDR4 2666MHz
40 |
41 |
42 | ); 43 | 44 | export default BenchmarkConfig; 45 | -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/ConnectNile.mdx: -------------------------------------------------------------------------------- 1 | import Callout from '@mdx/Callout.astro'; 2 | import CodeTabs from "@mdx/CodeTabs.astro"; 3 | 4 | Create a `index.ts` file in the `src` directory and initialize the connection: 5 | 6 | 7 | ```typescript copy 8 | import 'dotenv/config'; 9 | import { drizzle } from 'drizzle-orm/node-postgres'; 10 | 11 | const db = drizzle(process.env.NILEDB_URL!); 12 | ``` 13 | ```typescript copy 14 | import 'dotenv/config'; 15 | import { drizzle } from 'drizzle-orm/node-postgres'; 16 | 17 | // You can specify any property from the node-postgres connection options 18 | const db = drizzle({ 19 | connection: { 20 | connectionString: process.env.NILEDB_URL!, 21 | ssl: true 22 | } 23 | }); 24 | ``` 25 | ```typescript copy 26 | import 'dotenv/config'; 27 | import { drizzle } from "drizzle-orm/node-postgres"; 28 | import { Pool } from "pg"; 29 | 30 | const pool = new Pool({ 31 | connectionString: process.env.NILEDB_URL!, 32 | }); 33 | const db = drizzle({ client: pool }); 34 | ``` 35 | 36 | 37 | 38 | Nile provides **virtual tenant databases**. When you query Nile, you can set the tenant context and Nile will direct your queries to the virtual database for this particular tenant. All queries sent with tenant context will apply to that tenant alone (i.e. `select * from table` will result records only for this tenant). To learn more about how to set tenant context with Drizzle, check the **[official Nile-Drizzle example](https://www.thenile.dev/docs/getting-started/languages/drizzle#72-tenantdb)**. 39 | -------------------------------------------------------------------------------- /public/svg/upstash-icon-dark-bg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/ui/components/LandingNavbar.astro: -------------------------------------------------------------------------------- 1 |
2 | 8 |
9 | -------------------------------------------------------------------------------- /public/svg/upstash-icon-white-bg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/mdx/CodeTabs.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import {parse} from "node-html-parser"; 3 | 4 | interface Props { 5 | items: string[]; 6 | } 7 | 8 | const { items } = Astro.props; 9 | let slot = await Astro.slots.render('default'); 10 | const parsedHtml = parse(slot); 11 | 12 | parsedHtml.childNodes.forEach((tabContent, index) => { 13 | // @ts-ignore 14 | if (index !== 0) tabContent.classList.add('hidden'); 15 | }); 16 | --- 17 |
18 |
19 | {items.map((item, index) =>
{item}
)} 20 |
21 |
22 | 23 |
24 |
25 | 47 | -------------------------------------------------------------------------------- /public/svg/praha-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /public/svg/praha-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/mdx/get-started/cockroach/IntrospectCockroach.mdx: -------------------------------------------------------------------------------- 1 | Drizzle Kit provides a CLI command to introspect your database and generate a schema file with migrations. The schema file contains all the information about your database tables, columns, relations, and indices. 2 | 3 | For example, you have such table in your database: 4 | 5 | ```sql copy 6 | CREATE TABLE "users" ( 7 | "id" int4 PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), 8 | "name" varchar(255) NOT NULL, 9 | "age" integer NOT NULL, 10 | "email" varchar(255) NOT NULL, 11 | CONSTRAINT "users_email_unique" UNIQUE("email") 12 | ); 13 | ``` 14 | 15 | Pull your database schema: 16 | 17 | ```bash copy 18 | npx drizzle-kit pull --init 19 | ``` 20 | 21 | The result of introspection will be a `schema.ts` file, `meta` folder with snapshots of your database schema, sql file with the migration and `relations.ts` file for [relational queries](/docs/rqb). 22 | 23 | Here is an example of the generated `schema.ts` file: 24 | 25 | ```typescript copy filename="src/db/schema.ts" 26 | // table schema generated by introspection 27 | import { cockroachTable, unique, int4, varchar } from "drizzle-orm/cockroach-core" 28 | 29 | export const users = cockroachTable("users", { 30 | id: int4().primaryKey().generatedAlwaysAsIdentity({ name: "users_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), 31 | name: varchar({ length: 255 }).notNull(), 32 | age: integer().notNull(), 33 | email: varchar({ length: 255 }).notNull(), 34 | }, (table) => [ 35 | unique("users_email_unique").on(table.email) 36 | ]); 37 | ``` 38 | 39 | Learn more about introspection in the [documentation](/docs/drizzle-kit-pull). 40 | -------------------------------------------------------------------------------- /src/content/docs/guides/_map.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["conditional-filters-in-query", "Conditional filters in query"], 3 | ["incrementing-a-value", "Incrementing a value"], 4 | ["decrementing-a-value", "Decrementing a value"], 5 | ["include-or-exclude-columns", "Include or exclude columns"], 6 | ["toggling-a-boolean-field", "Toggling a boolean field"], 7 | ["count-rows", "Count rows"], 8 | ["upsert", "Upsert Query"], 9 | ["limit-offset-pagination", "Limit/Offset pagination"], 10 | ["cursor-based-pagination", "Cursor-based pagination"], 11 | ["timestamp-default-value", "Timestamp as a default value"], 12 | ["gel-ext-auth", "Gel Auth extension with Drizzle"], 13 | ["select-parent-rows-with-at-least-one-related-child-row", "Select parent rows with at least one related child row"], 14 | ["empty-array-default-value", "Empty array as a default value"], 15 | ["update-many-with-different-value", "Update many with different value for each row"], 16 | ["unique-case-insensitive-email", "Unique and Case-Insensitive Email Handling"], 17 | ["vector-similarity-search", "Vector similarity search with pgvector extension"], 18 | ["postgresql-full-text-search", "PostgreSQL full-text search"], 19 | ["d1-http-with-drizzle-kit", "Cloudflare D1 HTTP API with Drizzle Kit"], 20 | ["point-datatype-psql", "Point datatype in PostgreSQL"], 21 | ["postgis-geometry-point", "PostGIS geometry point"], 22 | ["postgresql-local-setup", "Local setup of PostgreSQL"], 23 | ["mysql-local-setup", "Local setup of MySQL"], 24 | ["seeding-with-partially-exposed-tables", "Seeding Partially Exposed Tables with Foreign Key"], 25 | ["seeding-using-with-option", "Seeding using 'with' option"], 26 | ["full-text-search-with-generated-columns", "Full-text search with Generated Columns"] 27 | ] 28 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/types.ts: -------------------------------------------------------------------------------- 1 | export interface IData { 2 | time: number; 3 | latency: { 4 | avg: number; 5 | p90: number; 6 | p95: number; 7 | }; 8 | cpus: { 9 | cpu1: number; 10 | cpu2: number; 11 | cpu3: number; 12 | cpu4: number; 13 | cpus: number; 14 | }; 15 | reqs: number; 16 | failReqs: number; 17 | totalFailReqs: number; 18 | totalReqs: number; 19 | avg: { 20 | p95: number; 21 | cpus: number; 22 | latency: number; 23 | reqs: number; 24 | }; 25 | max: { 26 | reqs: number; 27 | latency: number; 28 | }; 29 | } 30 | 31 | export interface IJSONData { 32 | time: string; 33 | core1: number; 34 | core2: number; 35 | core3: number; 36 | core4: number; 37 | reqs_per_sec: number; 38 | fail_reqs_per_sec: number; 39 | latency_95: number; 40 | latency_90: number; 41 | latency_99: number; 42 | latency_average: number; 43 | } 44 | 45 | export interface IParams { 46 | orm: "prisma-v7.1.0" | "prisma-v5.18.0" | "go"; 47 | dbSize: "micro" | "small" | "medium" | "large" | "huge" | "extreme"; 48 | projectType: "ecommerce" | "social" | "geo" | "analytics"; 49 | database: 50 | | "postgres" 51 | | "mysql" 52 | | "sqlite" 53 | | "serverless_postgres" 54 | | "serverless_mysql" 55 | | "serverless_sqlite"; 56 | runtime: 57 | | "node-24" 58 | | "node-22" 59 | | "node-20" 60 | | "node-18" 61 | | "bun-1.3.4" 62 | | "bun-1.1.25" 63 | | "go"; 64 | joins: boolean; 65 | } 66 | 67 | export interface IModalInputData { 68 | value: string; 69 | key: string; 70 | items: IModalInputDataItem[]; 71 | } 72 | 73 | export interface IModalInputDataItem { 74 | value: string; 75 | description?: string; 76 | disabled?: boolean; 77 | } 78 | -------------------------------------------------------------------------------- /src/mdx/get-started/singlestore/IntrospectSingleStore.mdx: -------------------------------------------------------------------------------- 1 | Drizzle Kit provides a CLI command to introspect your database and generate a schema file with migrations. The schema file contains all the information about your database tables, columns, relations, and indices. 2 | 3 | For example, you have such table in your database: 4 | 5 | ```sql copy 6 | CREATE TABLE `users_table` ( 7 | `id` int NOT NULL, 8 | `name` varchar(255) NOT NULL, 9 | `age` int NOT NULL, 10 | `email` varchar(255) NOT NULL, 11 | CONSTRAINT `users_table_id` PRIMARY KEY(`id`), 12 | CONSTRAINT `users_table_email_unique` UNIQUE(`email`) 13 | ); 14 | ``` 15 | 16 | Pull your database schema: 17 | 18 | ```bash copy 19 | npx drizzle-kit pull --init 20 | ``` 21 | 22 | The result of introspection will be a `schema.ts` file and `meta` folder with snapshots of your database schema 23 | 24 | Here is an example of the generated `schema.ts` file: 25 | 26 | ```typescript copy filename="src/db/schema.ts" 27 | // table schema generated by introspection 28 | import { 29 | singlestoreTable, 30 | singlestoreSchema, 31 | AnySingleStoreColumn, 32 | primaryKey, 33 | unique, 34 | varchar, 35 | int, 36 | } from 'drizzle-orm/singlestore-core'; 37 | import { sql } from 'drizzle-orm'; 38 | 39 | export const usersTable = singlestoreTable( 40 | 'users_table', 41 | { 42 | id: int().notNull(), 43 | name: varchar({ length: 255 }).notNull(), 44 | age: int().notNull(), 45 | email: varchar({ length: 255 }).notNull(), 46 | }, 47 | (table) => [ 48 | primaryKey({ columns: [table.id], name: 'users_table_id' }), 49 | unique('id').on(table.id), 50 | unique('users_table_email_unique').on(table.email), 51 | ], 52 | ); 53 | ``` 54 | 55 | Learn more about introspection in the [documentation](/docs/drizzle-kit-pull). -------------------------------------------------------------------------------- /src/mdx/get-started/postgresql/IntrospectPostgreSQL.mdx: -------------------------------------------------------------------------------- 1 | Drizzle Kit provides a CLI command to introspect your database and generate a schema file with migrations. The schema file contains all the information about your database tables, columns, relations, and indices. 2 | 3 | For example, you have such table in your database: 4 | 5 | ```sql copy 6 | CREATE TABLE IF NOT EXISTS "users" ( 7 | "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), 8 | "name" varchar(255) NOT NULL, 9 | "age" integer NOT NULL, 10 | "email" varchar(255) NOT NULL, 11 | CONSTRAINT "users_email_unique" UNIQUE("email") 12 | ); 13 | ``` 14 | 15 | Pull your database schema: 16 | 17 | ```bash copy 18 | npx drizzle-kit pull --init 19 | ``` 20 | 21 | The result of introspection will be a `schema.ts` file, `meta` folder with snapshots of your database schema, sql file with the migration and `relations.ts` file for [relational queries](/docs/rqb). 22 | 23 | Here is an example of the generated `schema.ts` file: 24 | 25 | ```typescript copy filename="src/db/schema.ts" 26 | // table schema generated by introspection 27 | import { pgTable, unique, integer, varchar } from "drizzle-orm/pg-core" 28 | import { sql } from "drizzle-orm" 29 | 30 | export const users = pgTable("users", { 31 | id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "users_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), 32 | name: varchar({ length: 255 }).notNull(), 33 | age: integer().notNull(), 34 | email: varchar({ length: 255 }).notNull(), 35 | }, (table) => [ 36 | unique("users_email_unique").on(table.email) 37 | ]); 38 | ``` 39 | 40 | Learn more about introspection in the [documentation](/docs/drizzle-kit-pull). 41 | -------------------------------------------------------------------------------- /src/ui/components/landing/benchmark/components/RuntimeSelector/NodeIcon.tsx: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return ( 3 | 11 | 12 | 13 | ); 14 | }; 15 | -------------------------------------------------------------------------------- /src/mdx/Tabs.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { parse } from 'node-html-parser'; 3 | 4 | interface Props { 5 | items: string[]; 6 | } 7 | 8 | const { items } = Astro.props; 9 | const slot = await Astro.slots.render('default'); 10 | const parsedHtml = parse(slot); 11 | 12 | parsedHtml.querySelectorAll('.tab__content').forEach((tabContent, index) => { 13 | if (index !== 0) tabContent.classList.add('hidden'); 14 | }); 15 | --- 16 | 17 |
18 |
19 | { 20 | items.map((item, index) => ( 21 |
25 | {item} 26 |
27 | )) 28 | } 29 |
30 |
31 | 32 |
33 |
34 | 57 | -------------------------------------------------------------------------------- /src/content/docs/connect-turso-database.mdx: -------------------------------------------------------------------------------- 1 | import Npm from "@mdx/Npm.astro"; 2 | import Callout from '@mdx/Callout.astro'; 3 | import AnchorCards from '@mdx/AnchorCards.astro'; 4 | import Steps from '@mdx/Steps.astro'; 5 | import WhatsNextPostgres from "@mdx/WhatsNextPostgres.astro"; 6 | import Prerequisites from "@mdx/Prerequisites.astro"; 7 | import CodeTabs from "@mdx/CodeTabs.astro"; 8 | import LibsqlTable from "@mdx/LibsqlTable.mdx"; 9 | import LibsqlTabs from "@mdx/LibsqlTabs.mdx"; 10 | 11 | # Drizzle \<\> Turso Database 12 | 13 | 14 | - Database [connection basics](/docs/connect-overview) with Drizzle 15 | - Turso Database - [website](https://docs.turso.tech/introduction) 16 | - Turso Database driver - [website](https://docs.turso.tech/connect/javascript) & [GitHub](https://github.com/tursodatabase/turso/tree/main/bindings/javascript) 17 | 18 | 19 | According to the **[official website](https://docs.turso.tech/introduction)**, 20 | Turso is the small database to power your big dreams in the age of AI. 21 | 22 | #### Step 1 - Install packages 23 | 24 | drizzle-orm@beta @tursodatabase/database 25 | -D drizzle-kit@beta 26 | 27 | 28 | #### Step 2 - Initialize the driver and make a query 29 | ```typescript 30 | import { drizzle } from 'drizzle-orm/tursodatabase/database'; 31 | 32 | const db = drizzle('sqlite.db'); 33 | 34 | const result = await db.execute('select 1'); 35 | ``` 36 | 37 | If you need to provide your existing drivers: 38 | 39 | ```typescript 40 | import { Database } from '@tursodatabase/drivers'; 41 | import { drizzle } from 'drizzle-orm/tursodatabase/database'; 42 | 43 | const client = new Database('sqlite.db'); 44 | const db = drizzle({ client }); 45 | 46 | const result = await db.execute('select 1'); 47 | ``` 48 | 49 | #### What's next? 50 | 51 | --------------------------------------------------------------------------------