© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•14mo ago•
3 replies
David Gomes

schemaFilter not working as expected

I've got this on my
drizzle.config.ts
drizzle.config.ts
:
schemaFilter: "public",
schemaFilter: "public",

And this is my
schema.ts
schema.ts
:
import { InferSelectModel } from "drizzle-orm";
import {
  bigint,
  boolean,
  jsonb,
  pgSchema,
  pgTable,
  text,
  timestamp,
} from "drizzle-orm/pg-core";

export const todos = pgTable(
  "todos",
  {
    id: bigint("id", { mode: "bigint" })
      .primaryKey()
      .generatedByDefaultAsIdentity(),
    userId: text("user_id")
      .notNull(),
    task: text("task").notNull(),
    isComplete: boolean("is_complete").notNull().default(false),
    insertedAt: timestamp("inserted_at", { withTimezone: true })
      .defaultNow()
      .notNull(),
  },
);

// Filter out the neon_identity schema in `drizzle.config.ts` in order to NOT generate the schema for it.
export const neonIdentitySchema = pgSchema("neon_identity");

export const users = neonIdentitySchema.table("users_sync", {
  rawJson: jsonb("raw_json").notNull(),
  id: text().primaryKey().notNull(),
  name: text(),
  email: text(),
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }),
  deletedAt: timestamp("deleted_at", { withTimezone: true, mode: 'string' }),
});

export type Todo = InferSelectModel<typeof todos>;
import { InferSelectModel } from "drizzle-orm";
import {
  bigint,
  boolean,
  jsonb,
  pgSchema,
  pgTable,
  text,
  timestamp,
} from "drizzle-orm/pg-core";

export const todos = pgTable(
  "todos",
  {
    id: bigint("id", { mode: "bigint" })
      .primaryKey()
      .generatedByDefaultAsIdentity(),
    userId: text("user_id")
      .notNull(),
    task: text("task").notNull(),
    isComplete: boolean("is_complete").notNull().default(false),
    insertedAt: timestamp("inserted_at", { withTimezone: true })
      .defaultNow()
      .notNull(),
  },
);

// Filter out the neon_identity schema in `drizzle.config.ts` in order to NOT generate the schema for it.
export const neonIdentitySchema = pgSchema("neon_identity");

export const users = neonIdentitySchema.table("users_sync", {
  rawJson: jsonb("raw_json").notNull(),
  id: text().primaryKey().notNull(),
  name: text(),
  email: text(),
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }),
  deletedAt: timestamp("deleted_at", { withTimezone: true, mode: 'string' }),
});

export type Todo = InferSelectModel<typeof todos>;

When I run
drizzle-kit generate
drizzle-kit generate
, for some reason I still get:
CREATE SCHEMA "neon_identity";
...
CREATE TABLE "neon_identity"."users_sync" (
...
CREATE SCHEMA "neon_identity";
...
CREATE TABLE "neon_identity"."users_sync" (
...

So, the
schemaFilter
schemaFilter
is not working... It's still trying to generate the
neon_identity
neon_identity
schema which it should be skipping.

This is on the latest
drizzle-kit
drizzle-kit
, btw, 0.30.1.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

inArray not working as expected
Drizzle TeamDTDrizzle Team / help
16mo ago
Drizzle-kit not working as expected
Drizzle TeamDTDrizzle Team / help
16mo ago
DrizzleKit "tablesFilter" not working as expected
Drizzle TeamDTDrizzle Team / help
2y ago
pgEnum conversion not working as expected
Drizzle TeamDTDrizzle Team / help
2y ago