Skip to content

void db push deletes empty auth tables without listing them #977

In progress

Description

@hyfdev

With auth enabled, confirming a void db push prompt deletes the auth tables that void db migrate created.

The prompt doesn't list them while they're empty, because Drizzle Kit lists a table only when it has rows.

On local D1 in Void 1.12.2, after migrating and adding a column to the app's schema, push shows this:

 Warning  Found data-loss statements:
· You're about to delete _void_migrations table with 2 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED

Do you still want to push changes?

The _void_migrations line is a separate bug (#976), also fixed in #935.

Choosing "Yes, I want to remove 1 table" also deletes user, session, account and verification.

void db generate passes the generated .void/better-auth-schema.ts to Drizzle Kit, but void db push doesn't.

So Kit treats the auth tables as tables the schema no longer has.

To reproduce:

  1. In an empty directory, run npm install -D void@1.12.2 and npx void init. Keep the defaults, but choose "Skip deployment setup".
  2. Add auth: { providers: ['email'] } inside defineConfig in void.config.ts.
  3. Run npx void db generate and npx void db migrate.
  4. Add note: text('note') to messages in db/schema.ts, run npx void db push, and choose "Yes, I want to remove 1 table".

#935 fixes it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions