drizzle-team / drizzle-team/drizzle-orm

[BUG]: ENOENT error on subsequent runs with absolute path in 'out' config

Open
#1,583 6 comments 0 reactions 0 assignees View on GitHub
bug drizzle/kit priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.29.1

### What version of `drizzle-kit` are you using?

0.20.6

### Describe the Bug

**Issue:**
When using an absolute path in the `drizzle.config.ts` for the `out` property, the first run of `drizzle-kit generate:sqlite` completes successfully, generating the SQL migration file. However, any subsequent runs throw me

`Error: ENOENT: no such file or directory, open './/home/ramzan/Projects/CDF/drizzle/meta/0000_snapshot.json'`

**Steps to Reproduce:**
1. Define the `drizzle.config.ts` with an absolute path for the `out` property:
```typescript
import type {Config} from "drizzle-kit";

export default {
schema: "./migrations/schema.ts",
out: "/home/ramzan/Projects/CDF/drizzle"
} satisfies Config;
```
2. Run `npx drizzle-kit generate:sqlite`. It executes correctly the first time.
3. Run `npx drizzle-kit generate:sqlite` again without changing any config.

### Expected behavior

**Expected Behavior:**
The tool should recognize the absolute path on subsequent runs and correctly reference the generated `meta/0000_snapshot.json` file.

**Actual Behavior:**
The second run prepends an additional `./` to the absolute path, causing the file lookup to fail

### Environment & setup

- **Hardware Model**: Lenovo ThinkPad X13 Yoga Gen 1
- **Processor**: Intel® Core™ i5-10210U x 8
- **Graphics**: Mesa Intel® UHD Graphics (CML GT2)
- **OS Name**: Debian GNU/Linux 12 (bookworm)
- **OS Type**: 64-bit
- **Node**: v20.10.0
- **NPM**: v10.2.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.