Skip to content

den-dev docker-compose: two bugs prevent den from starting against local MySQL (drizzle-kit index syntax + missing --import tsx) #3392

Description

@cesartaira86

Environment

  • Docker Compose stack: packaging/docker/docker-compose.den-dev.yml
  • MySQL: 8.4 (as provisioned by the compose file)
  • drizzle-kit: 0.31.9

Bug 1 — drizzle-kit generates invalid SQL for MySQL prefix-length index

ee/packages/den-db/src/schema/auth.ts:207:
index("oauth_access_token_token").on(sql${table.token}(191))

drizzle-kit push fails with:
Error: You have an error in your SQL syntax ... near 'token(191))' at line 1
sql: 'CREATE INDEX oauth_access_token_token ON oauthAccessToken (``token(191));'

drizzle-kit double-wraps the already-backtick-quoted interpolated column
identifier when serializing this expression index for MySQL. Likely
affects any other prefix-length index in the schema. Workaround:
comment out the index.

Bug 2 — den service command missing --import tsx on the API start step

packaging/docker/docker-compose.den-dev.yml, den service command:
... && node /app/ee/apps/den-api/dist/main.js

With OPENWORK_DEV_MODE=1, den-api loads den-db from source (not the
built dist/) at runtime, and ee/packages/den-db/src/schema.ts does
export * from "./schema/index" without extension — which native
Node ESM resolution can't resolve without a loader. The drizzle-kit
push step in the same command already uses --import tsx, but the
second node invocation doesn't, causing:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'/app/ee/packages/den-db/src/schema/index' imported from
/app/ee/packages/den-db/src/schema.ts

Fix: add --import tsx to the second node invocation too:
... && node --import tsx /app/ee/apps/den-api/dist/main.js

(Note: adding a .ts extension to the schema.ts import instead breaks
the tsup build step with TS5097, so the compose command is the
correct place to fix this, not the schema import.)

Result
With both fixes applied, docker compose -f packaging/docker/docker-compose.den-dev.yml up
starts mysql, den, and web cleanly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions