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

[BUG]: drizzle-kit introspect produces diffs without underlying schema changes #2530

Open
brittlewis12 opened this issue Jun 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@brittlewis12
Copy link

brittlewis12 commented Jun 18, 2024

What version of drizzle-orm are you using?

0.31.1

What version of drizzle-kit are you using?

0.22.2

Describe the Bug

  1. without making changes to the db schema, run drizzle-kit introspect.

expected behavior:

  • no diff in generated schema.ts or relations.ts files

actual behavior

  • relations & table definitions are reordered arbitrarily each time the command is run.

Expected behavior

schema & relations definitions should be defined one of alphabetical, creation, or dependency order.

said differently, I expect drizzle-kit introspect to be idempotent. for any single given input schema, the generated output should be identical, no matter how many times the command is run.

I do not have a strong preference or intuition behind one or the other, but alphabetical is easy to reason about verify at a glance.

#1306 appears loosely related, but materially distinct enough that I wanted to raise a dedicated issue. please feel free to recategorize as you wish.

Environment & setup

running Bun 1.1.13 on macOS 14.5, connecting to a postgres 16 db through Neon's serverless client.

here's our drizzle.config.js:

import { defineConfig } from "drizzle-kit";

export default defineConfig({
  dialect: "postgresql",
  introspect: {
    casing: "camel",
  },
  schema: "./src/schema.ts",
  out: "./drizzle",
  dbCredentials: {
    url: process.env.DATABASE_URL,
  },
});
@brittlewis12 brittlewis12 added the bug Something isn't working label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant