Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: Facility to ignore tables/views on drizzle-kit push #4008

Open
1 task done
Mardoxx opened this issue Jan 26, 2025 · 1 comment
Open
1 task done

[FEATURE]: Facility to ignore tables/views on drizzle-kit push #4008

Mardoxx opened this issue Jan 26, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@Mardoxx
Copy link

Mardoxx commented Jan 26, 2025

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I enabled pg_stat_statements

npx drizzle-kit push

DROP VIEW "public"."pg_stat_statements_info";
DROP VIEW "public"."pg_stat_statements";
@Mardoxx Mardoxx added the enhancement New feature or request label Jan 26, 2025
@Mardoxx Mardoxx changed the title [FEATURE]: Facility to ignore tables on drizzle-kit push [FEATURE]: Facility to ignore tables/views on drizzle-kit push Jan 26, 2025
@Flet
Copy link

Flet commented Feb 5, 2025

Hello! I ran into this as well. I think its discussed here:
#2410

Also I found it referenced over at tembo docs with a workaround:
https://tembo.io/docs/getting-started/quickstarts/database-clients-and-tools/drizzle

The gist of it:
Use tableFilter will filter tables as well as views

import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/lib/db/schema.ts',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL,
  },
  verbose: true,
  strict: true,
  out: './drizzle',
  tablesFilter: ['!pg_stat_statements', '!pg_stat_statements_info'], // 👈 👈
});

This can also be used via cmd line
https://orm.drizzle.team/docs/drizzle-kit-push#including-tables-schemas-and-extensions

It would be great if the docs could be updated to mention this filter also handles views! :)

good luck! 🍀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants