Skip to content

[BUG]: Drizzle-kit - push tries to delete non-public schemas by default (pscale_extensions) #5190

@wilsonowilson

Description

@wilsonowilson

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

1.0.0-beta.6-4414a19

What version of drizzle-kit are you using?

1.0.0-beta.6-4414a19

Other packages

No response

Describe the Bug

When running drizzle-kit push on my schema.ts file, it tries to delete schemas not-defined in my file.

% pnpm exec drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/wilson/Developer/Projects/example/stack/hc-auth-database/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...

┌─── public.hc_sessions.expires_at column changed:
│ notNull: false -> true
├───
│ ALTER TABLE "hc_sessions" ALTER COLUMN "expires_at" SET NOT NULL;
└───

┌─── public.hc_sessions.created_at column changed:
│ notNull: false -> true
├───
│ ALTER TABLE "hc_sessions" ALTER COLUMN "created_at" SET NOT NULL;
└───


 Warning  There're potential data loss statements:
· You're about to delete pscale_extensions schema with 2 tables

In my case, I'm running drizzle against a Planetscale Postgres instance.

Steps to reproduce:

  • Create a dummy schema.ts with one table and one column
  • Connect to a Planetscale Postgres instance
  • Run drizzle-kit push

Workaround

Set schemaFilter: ['public'] on drizzle.config.ts. That said, I'm not sure if this should happen by default?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions