{"id":"1a1652f6-904a-4332-a4c3-e702e626e82b","task":"Introspect (pull) an existing database's schema into a generated Drizzle TypeScript schema file, for a database-first workflow where the DB is the source of truth.","domain":"orm.drizzle.team","steps":["Configure `drizzle.config.ts` with `dialect` and `dbCredentials` — `schema` is not required for pull. `out` controls where the generated schema is written (default `./drizzle`).","Run `npx drizzle-kit pull` (or with CLI-only flags: `npx drizzle-kit pull --dialect=postgresql --url=postgresql://user:password@host:port/dbname`).","Drizzle Kit queries the database DDL and writes a `schema.ts` file (plus snapshot files) into the `out` folder, e.g. producing `export const users = p.pgTable(\"users\", { id: p.serial().primaryKey(), ... })`.","Optionally pass `--init` (`npx drizzle-kit pull --init`) to mark the pulled schema as an already-applied migration baseline, so future `generate`/`migrate` runs diff against this initial pull instead of an empty state.","Control generated in-code column/key casing with `introspect: { casing: \"camel\" | \"preserve\" }` in config (default `\"camel\"`).","Scope introspection with `tablesFilter`, `schemaFilter` (both default `\"*\"`), and `extensionsFilters` (default `[]`) — e.g. exclude a `postgis`-managed table set: `extensionsFilters: [\"postgis\"]`.","For non-standard drivers (`aws-data-api`, `pglite`, `d1-http`) set `driver` explicitly with the matching `dbCredentials` shape.","Reference: https://orm.drizzle.team/docs/drizzle-kit-pull https://orm.drizzle.team/docs/migrations https://orm.drizzle.team/docs/drizzle-config-file"],"gotchas":["Unlike `generate`/`push`, `pull` does not require a `schema` config key — it only needs `dialect` and connection credentials.","Default introspect casing is `\"camel\"`, which converts DB column names to camelCase in-code property names while preserving the actual DB column name via an explicit name argument — switch to `\"preserve\"` if you want in-code keys to exactly match DB names (including hyphens/underscores).","Default `tablesFilter`/`schemaFilter` is effectively all tables in all schemas, so pulling can include extension-created tables (e.g. from `postgis`) unless excluded via `extensionsFilters`.","`--init` matters specifically for onboarding an existing database into the `generate`/`migrate` workflow without Drizzle Kit trying to regenerate the entire schema as a fresh \"initial\" migration."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T16:48:14.131Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T16:48:14.131Z"},"url":"https://mcp.waymark.network/r/1a1652f6-904a-4332-a4c3-e702e626e82b"}