### Project Setup and Development Commands Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/drizzle-run/README.md Steps to install dependencies, apply database migrations, and start the development server for the Drizzle Run project. Assumes a monorepo structure. ```bash cp .env.example .env npm install cd apps/drizzle-run npm run db:server:migration:deploy npm run dev ``` -------------------------------- ### Supabase CLI Commands Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/drizzle-run/README.md Commands to manage the local Supabase instance. This includes starting the Supabase project and restarting it after configuration changes. ```bash supabase start supabase stop ``` -------------------------------- ### Drizzle Run Project Structure Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/drizzle-run/README.md Information about the project's monorepo structure, indicating that changes in packages/* will be reflected in the main application. ```javascript // It's a npm workspace monorepo, everything is linked together so if you make changes to `packages/*`, they will be reflected in the app. ``` -------------------------------- ### GitHub Authentication Environment Variables Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/drizzle-run/README.md Configuration for GitHub OAuth authentication. Requires creating a GitHub OAuth app and adding its client ID and secret to the .env file. ```env SUPABASE_AUTH_GITHUB_CLIENT_ID= SUPABASE_AUTH_GITHUB_SECRET= ``` -------------------------------- ### Install @drizzle-lab/api (Bash) Source: https://github.com/rphlmr/drizzle-lab/blob/main/packages/api/README.md Shows how to install the @drizzle-lab/api package using npm. This is the first step to using the library's schema documentation and visualization features. ```bash npm install @drizzle-lab/api ``` -------------------------------- ### PostgreSQL Schema Import and Transformation (TypeScript) Source: https://github.com/rphlmr/drizzle-lab/blob/main/packages/api/README.md Provides TypeScript code examples for importing and transforming PostgreSQL schemas using `@drizzle-lab/api`. It covers importing from files, generating SQL, creating snapshots, and converting snapshots to TypeScript, utilizing functions from `@drizzle-lab/api/pg` and `@drizzle-lab/api/config/node`. ```typescript import { importDrizzleConfig } from "@drizzle-lab/api/config/node"; import { importFromFiles } from "@drizzle-lab/api/pg/node"; import { importFromDatabase, schemaToSql, snapshotToTypeScript, drizzleObjectsToSnapshot } from "@drizzle-lab/api/pg"; // Import schema from config const config = await importDrizzleConfig(); const drizzleObjects = await importFromFiles(config.schema); // Import schema from database const snapshot = drizzleObjectsToSnapshot(drizzleObjects, config); // Generate SQL const sql = schemaToSql(schema); // Generate TypeScript const ts = snapshotToTypeScript(snapshot, "preserve"); ``` -------------------------------- ### MySQL Schema Import and Transformation (TypeScript) Source: https://github.com/rphlmr/drizzle-lab/blob/main/packages/api/README.md Provides TypeScript code examples for importing and transforming MySQL schemas using `@drizzle-lab/api`. It covers importing from files, generating SQL, creating snapshots, and converting snapshots to TypeScript, utilizing functions from `@drizzle-lab/api/mysql` and `@drizzle-lab/api/config/node`. ```typescript import { importDrizzleConfig } from "@drizzle-lab/api/config/node"; import { importFromFiles } from "@drizzle-lab/api/mysql/node"; import { importFromDatabase, schemaToSql, snapshotToTypeScript, drizzleObjectsToSnapshot } from "@drizzle-lab/api/mysql"; // Import schema from config const config = await importDrizzleConfig(); const drizzleObjects = await importFromFiles(config.schema); // Generate snapshot const snapshot = drizzleObjectsToSnapshot(drizzleObjects, config); // Generate SQL const sql = schemaToSql(schema); // Generate TypeScript const ts = snapshotToTypeScript(snapshot, "preserve"); ``` -------------------------------- ### SQLite Schema Import and Transformation (TypeScript) Source: https://github.com/rphlmr/drizzle-lab/blob/main/packages/api/README.md Provides TypeScript code examples for importing and transforming SQLite schemas using `@drizzle-lab/api`. It covers importing from files, generating SQL, creating snapshots, and converting snapshots to TypeScript, utilizing functions from `@drizzle-lab/api/sqlite` and `@drizzle-lab/api/config/node`. ```typescript import { importDrizzleConfig } from "@drizzle-lab/api/config/node"; import { importFromFiles } from "@drizzle-lab/api/sqlite/node"; import { importFromDatabase, schemaToSql, snapshotToTypeScript, drizzleObjectsToSnapshot } from "@drizzle-lab/api/sqlite"; // Import schema from config const config = await importDrizzleConfig(); const drizzleObjects = await importFromFiles(config.schema); // Generate snapshot const snapshot = drizzleObjectsToSnapshot(drizzleObjects, config); // Generate SQL const sql = schemaToSql(schema); // Generate TypeScript const ts = snapshotToTypeScript(snapshot, "preserve"); ``` -------------------------------- ### Drizzle Lab CLI: Base Command Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/cli/README.md Provides the base usage for the Drizzle Lab CLI, listing available top-level commands such as `visualizer` and `generate`. It also shows global flags for help and version. ```sh Usage: Drizzle Lab CLI [command] Available Commands: visualizer generate Flags: -h, --help help for Drizzle Lab CLI -v, --version version for Drizzle Lab CLI ``` -------------------------------- ### Document Schema with `explain` Extension (TypeScript) Source: https://github.com/rphlmr/drizzle-lab/blob/main/packages/api/README.md Demonstrates how to use the `explain` function from `@drizzle-lab/api/extensions` to add detailed documentation to Drizzle schema objects. It allows specifying descriptions for tables, columns, and JSON shapes, enhancing schema understanding. ```typescript import { explain } from "@drizzle-lab/api/extensions"; import { pgTable, text, jsonb } from "drizzle-orm/pg-core"; export const users = pgTable("users", { id: text("id").primaryKey(), name: text("name").notNull(), metadata: jsonb("metadata").$type<{ role: string }>(), }); explain(users, { description: "Users table storing core user information", columns: { id: "Unique identifier for the user", name: "User's full name", metadata: "Additional user metadata stored as JSON", }, jsonShapes: { metadata: { role: "string", }, }, }); ``` -------------------------------- ### Drizzle Lab CLI: Generate Command Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/cli/README.md Details the `generate` command for the Drizzle Lab CLI. This command supports subcommands for generating schema snapshots (`snapshot`) and SQL (`sql`). It includes options for specifying the config file and enabling debug mode. ```sh Usage: Drizzle Lab CLI generate [command] Available Commands: snapshot Generate the snapshot for the current schema sql Generate the SQL for the current schema Flags: -c, --config string Path to drizzle config file --debug Enable log output (default: false) Global flags: -h, --help help for generate -v, --version version for Drizzle Lab CLI ``` -------------------------------- ### Drizzle Lab CLI: Visualizer Command Source: https://github.com/rphlmr/drizzle-lab/blob/main/apps/cli/README.md Documents the `visualizer` command for the Drizzle Lab CLI. This command is used to generate and save visualizer data for Drizzle projects, with options for configuration file path, debug mode, save directory, project ID, TypeScript configuration, port, and environment file path. ```sh Usage: Drizzle Lab CLI visualizer [flags] Flags: -c, --config string Path to drizzle config file --debug Enable log output (default: false) --save-dir string Directory to save the visualizer data (default: ".drizzle") --project-id string A unique identifier for the current visualized project. It is used as filename to save the visualizer state. (default: "visualizer") --ts-config string Path to tsconfig.json. It is used to resolve TypeScript paths aliases. (default: "./tsconfig.json") -p, --port number Port to run visualizer on (default: 64738) -e, --env-path string Path to a .env file Global flags: -h, --help help for visualizer -v, --version version for Drizzle Lab CLI ``` -------------------------------- ### Configure Drizzle Lab Project ID (TypeScript) Source: https://github.com/rphlmr/drizzle-lab/blob/main/packages/api/README.md Shows how to configure project-specific settings for Drizzle Lab, such as setting a `projectId`. This is done within the `drizzle.config.ts` file using `defineConfig`. ```typescript export default defineConfig({ // ... lab: { projectId: "drizzle-lab", // optional, defaults to "drizzle-lab". Used to identify the project in json output }, }); ``` -------------------------------- ### Build Icons Source: https://github.com/rphlmr/drizzle-lab/blob/main/shared/ui/src/icons/README.md Command to generate SVG icons used by the application. This process is essential for updating or creating new icon assets. ```shell icons build ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.