### Start Development Server Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Starts the local development server, typically accessible at `localhost:4321`. ```bash pnpm run dev ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Use this command to install all project dependencies. ```bash pnpm install ``` -------------------------------- ### Install Drizzle Gateway on Linux ARM64 Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/binary.mdx Download the Drizzle Gateway binary for Linux ARM64, make it executable, and run it. Access the web interface at http://localhost:4983 after starting. ```shell mkdir drizzle-gateway cd drizzle-gateway curl -Lo start https://pub-e240a4fd7085425baf4a7951e7611520.r2.dev/drizzle-gateway-1.3.0-linux-arm64 chmod +x start ./start # Once Drizzle Gateway is running, you can access it via the web interface at http://localhost:4983 ``` -------------------------------- ### Install Drizzle Gateway on Linux x64 Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/binary.mdx Download the Drizzle Gateway binary for Linux x64, make it executable, and run it. Access the web interface at http://localhost:4983 after starting. ```shell mkdir drizzle-gateway cd drizzle-gateway curl -Lo start https://pub-e240a4fd7085425baf4a7951e7611520.r2.dev/drizzle-gateway-1.3.0-linux-x64 chmod +x start ./start # Once Drizzle Gateway is running, you can access it via the web interface at http://localhost:4983 ``` -------------------------------- ### List Supported Dialects Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/Dialects.mdx This example demonstrates how to dynamically list supported database dialects using frontmatter variables. ```mdx dialects: ['postgresql', 'mysql', 'sqlite', 'turso'] --- {frontmatter.dialects.map(dialect => <>{dialect} )} ``` -------------------------------- ### Install Drizzle Gateway on macOS ARM64 Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/binary.mdx Download the Drizzle Gateway binary for macOS ARM64, make it executable, and run it. Access the web interface at http://localhost:4983 after starting. ```shell mkdir drizzle-gateway cd drizzle-gateway curl -Lo start https://pub-e240a4fd7085425baf4a7951e7611520.r2.dev/drizzle-gateway-1.3.0-macos-arm64 chmod +x start ./start # Once Drizzle Gateway is running, you can access it via the web interface at http://localhost:4983 ``` -------------------------------- ### Install Drizzle Gateway on macOS x64 Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/binary.mdx Download the Drizzle Gateway binary for macOS x64, make it executable, and run it. Access the web interface at http://localhost:4983 after starting. ```shell mkdir drizzle-gateway cd drizzle-gateway curl -Lo start https://pub-e240a4fd7085425baf4a7951e7611520.r2.dev/drizzle-gateway-1.3.0-macos-x64 chmod +x start ./start # Once Drizzle Gateway is running, you can access it via the web interface at http://localhost:4983 ``` -------------------------------- ### Get Astro CLI Help Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Displays help information for using the Astro CLI. ```bash pnpm run astro -- --help ``` -------------------------------- ### Data Structure Example Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md An example of a data structure that might be used for progress tracking, including dates and details. ```yaml progress: number weeks: - date: start: "YYYY-MM-DD" details: - string ``` -------------------------------- ### Libsql Connection Examples Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/LibsqlTabs.mdx These snippets show how to initialize the drizzle ORM for Libsql connections using different import paths for various environments. ```typescript import { drizzle } from 'drizzle-orm/libsql'; const db = drizzle({ connection: { url: process.env.DATABASE_URL, authToken: process.env.DATABASE_AUTH_TOKEN }}); ``` ```typescript import { drizzle } from 'drizzle-orm/libsql/node'; const db = drizzle({ connection: { url: process.env.DATABASE_URL, authToken: process.env.DATABASE_AUTH_TOKEN }}); ``` ```typescript import { drizzle } from 'drizzle-orm/libsql/web'; const db = drizzle({ connection: { url: process.env.DATABASE_URL, authToken: process.env.DATABASE_AUTH_TOKEN }}); ``` ```typescript import { drizzle } from 'drizzle-orm/libsql/http'; const db = drizzle({ connection: { url: process.env.DATABASE_URL, authToken: process.env.DATABASE_AUTH_TOKEN }}); ``` ```typescript import { drizzle } from 'drizzle-orm/libsql/ws'; const db = drizzle({ connection: { url: process.env.DATABASE_URL, authToken: process.env.DATABASE_AUTH_TOKEN }}); ``` ```typescript import { drizzle } from 'drizzle-orm/libsql/wasm'; const db = drizzle({ connection: { url: process.env.DATABASE_URL, authToken: process.env.DATABASE_AUTH_TOKEN }}); ``` -------------------------------- ### Pull Drizzle Gateway Docker Image Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/docker.mdx Fetches the latest version of the Drizzle Gateway Docker image from the GitHub Container Registry. Ensure Docker is installed and running. ```shell # pull latest version docker pull ghcr.io/drizzle-team/gateway:latest ``` -------------------------------- ### Run Drizzle Gateway Docker Container Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/docker.mdx Starts the Drizzle Gateway service in detached mode. It maps ports, sets environment variables for configuration (optional), and mounts the persistent volume. Access the web interface at http://localhost:4983. ```shell # start the studio docker run -d \ --name drizzle-gate \ --restart always \ -p 4983:4983 \ -e PORT=4983 \ -e STORE_PATH=./app \ -e MASTERPASS=your_master_password \ -v drizzle-gateway:/app \ ghcr.io/drizzle-team/gateway:latest # Once Drizzle Gateway is running, you can access it via the web interface at http://localhost:4983 ``` -------------------------------- ### Basic $count Usage Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/$count.mdx Use $count to get the total number of records in a table. It can also be used with filters to count specific records. ```typescript const count = await db.$count(users); // ^? number ``` ```typescript const count = await db.$count(users, eq(users.name, "Dan")); // works with filters ``` -------------------------------- ### Preview Production Build Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Allows you to preview the production build locally before deploying. ```bash pnpm run preview ``` -------------------------------- ### Build Production Site Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Generates a production-ready build of the site in the `./dist/` directory. ```bash pnpm run build ``` -------------------------------- ### Project Structure: Documentation Content Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md MDX files for documentation are located in the `src/content/documentation` directory. ```text ├── src/ │ ├── content/ │ │ └── documentation ``` -------------------------------- ### Project Structure: Shipping YAML Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Shipping configuration is managed via a YAML file at `src/data/shipping.yaml`. ```text ├── src/ │ ├──data/ │ │ └── shipping.yaml ``` -------------------------------- ### Run Astro CLI Commands Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Execute Astro CLI commands, such as adding integrations or checking the project. ```bash pnpm run astro ... ``` -------------------------------- ### Configure Drizzle Kit with PGLite Driver Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/DriversExamples.mdx This configuration is for using the PGLite driver, which allows for in-memory or file-based SQLite databases. Specify the 'url' for either an in-memory database or a directory path. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ dialect: "postgresql", schema: "./src/schema.ts", driver: "pglite", dbCredentials: { // inmemory url: ":memory:" // or database folder url: "./database/" }, }; ``` -------------------------------- ### Project Structure: Roadmap Markdown Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md The roadmap is defined in a markdown file located at `src/data/roadmap.md`. ```text ├── src/ │ ├──data/ │ │ └── roadmap.md ``` -------------------------------- ### Configure Schema Path for Directory Contents Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/SchemaFilePaths.mdx Use a wildcard to include all schema files within a specific subdirectory. This is helpful when all your schemas are grouped under a common folder like 'schema'. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ schema: "./src/schema/*", }); ``` -------------------------------- ### Create Docker Volume for Configuration Source: https://github.com/drizzle-team/gateway-website/blob/main/src/content/docs/docker.mdx Creates a named Docker volume to store Drizzle Gateway's configuration persistently. This volume will be mounted into the container. ```shell # persistent volume is required for configuration file docker volume create drizzle-gateway ``` -------------------------------- ### SQL Equivalent for $count Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/$count.mdx These SQL queries demonstrate the underlying operations performed by the $count operator. ```sql select count(*) from "users"; ``` ```sql select count(*) from "users" where "name" = 'Dan'; ``` -------------------------------- ### Project Structure: Announcements Data Source: https://github.com/drizzle-team/gateway-website/blob/main/README.md Markdown files for announcements are stored in the `src/data/announcements` directory. ```text ├── src/ │ ├──data/ │ │ └── announcements ``` -------------------------------- ### Configure Schema Path for SQL Files Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/SchemaFilePaths.mdx Specify schema files that end with '.sql.ts' using a glob pattern. This is a convention for organizing SQL-related schema definitions. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ schema: "./src/**/*.sql.ts", // Dax's favourite }); ``` -------------------------------- ### Configure Schema Path for Multiple Schema Files Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/SchemaFilePaths.mdx Use glob patterns to include schema files from different subdirectories or provide an explicit array of paths for granular control. This is useful for organizing schemas by feature or module. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ schema: "./src/**/schema.ts", //or schema: ["./src/user/schema.ts", "./src/posts/schema.ts"] }); ``` -------------------------------- ### Configure Drizzle Kit with AWS Data API Driver Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/DriversExamples.mdx Use this configuration for connecting to databases via AWS Data API. Ensure your AWS credentials and resource/secret ARNs are correctly set. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ dialect: "postgresql", schema: "./src/schema.ts", driver: "aws-data-api", dbCredentials: { database: "database", resourceArn: "resourceArn", secretArn: "secretArn", }, }; ``` -------------------------------- ### Configure Drizzle Kit with Cloudflare D1 HTTP Driver Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/DriversExamples.mdx Configuration for the Cloudflare D1 HTTP driver. You will need your Cloudflare account ID, database ID, and an API token. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ dialect: "sqlite", schema: "./src/schema.ts", driver: "d1-http", dbCredentials: { accountId: "accountId", databaseId: "databaseId", token: "token", }, }; ``` -------------------------------- ### Configure Schema Path for Single File Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/SchemaFilePaths.mdx Specify the exact path to your schema file when it's located at the root of your src directory. Ensure drizzle.config.ts is at the project root. ```typescript import { defineConfig } from "drizzle-kit"; export default defineConfig({ schema: "./src/schema.ts", }); ``` -------------------------------- ### $count with Relational Queries Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/$count.mdx Utilize $count within the `extras` configuration of Drizzle's relational query builder to include counts in your query results. ```typescript const users = await db.query.users.findMany({ extras: { postsCount: db.$count(posts, eq(posts.authorId, users.id)), }, }); ``` -------------------------------- ### $count in Subqueries Source: https://github.com/drizzle-team/gateway-website/blob/main/src/mdx/$count.mdx Integrate $count within subqueries to retrieve counts related to a parent query, such as counting posts per user. ```typescript const users = await db.select({ ...users, postsCount: db.$count(posts, eq(posts.authorId, users.id)), }).from(users); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.