drizzle-team / drizzle-team/drizzle-orm

[Bug] drizzle-kit 1.0 beta: `strict` flag silently deprecated, destructive operations execute without confirmation

Open
#5,249 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

# [Bug] drizzle-kit 1.0 beta: `strict` flag silently deprecated, destructive operations execute without confirmation

## Human Summary
Setting up in an existing codebase where the tables at the moment have no data, so perhaps the DROP operations would get caught when tables have data. I did setup 1.0 beta in another project where I'm still getting confirmations so i'm not sure why this project is having issues.

## Summary

`drizzle-kit push` in 1.0.0-beta.9 performs schema changes (including destructive `DROP TABLE`) without any confirmation prompt. The `strict: true` config option that previously required user approval for ANY schema change is silently ignored in config files and errors when passed via CLI. Users need the ability to review and approve ALL pending changes before execution, especially in production environments.

## Environment

- drizzle-kit: 1.0.0-beta.9
- drizzle-orm: 1.0.0-beta.9
- Database: PostgreSQL
- OS: macOS

## Reproduction

1. Create a drizzle config with `strict: true`:

```typescript
import { defineConfig } from 'drizzle-kit'

export default defineConfig({
dialect: 'postgresql',
schema: ['./schema/index.ts'],
out: './migrations',
strict: true, // This is silently ignored
dbCredentials: { url: process.env.DATABASE_URL },
})
```

1. Have a table in your schema that exists in the database (with or without data)

2. Remove that table from your schema file

3. Run `drizzle-kit push`

**Expected:** Confirmation prompt before dropping the table (as `strict: true` previously provided)

**Actual:** Table is immediately dropped without any prompt:

```
$ bun drizzle-kit push
Reading config file 'drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
DROP TABLE "something"."raw_data";
[✓] Changes applied
```

## Issues

### 1. `strict` flag silently deprecated in config, errors on CLI

**Config file:** `strict: true` is completely ignored with no warning

```typescript
// This is silently ignored - no warning, no effect
export default defineConfig({ strict: true, ... })
```

**CLI flag:** Throws deprecation error and exits

```bash
$ drizzle-kit push --strict
⚠️ Deprecated: Do not use 'strict' flag. Use 'explain' instead
# Process exits with code 1
```

### 2. No confirmation for destructive operations

The code suggests there should be prompts for data-loss scenarios:

```javascript
// From bin.cjs
if (!force && hints.length > 0) {
const { data } = await render(new Select(["No, abort", "Yes, I want to execute all statements"]));
}
```

However, `DROP TABLE` executed without any prompt in my testing, suggesting either:

- The hints/suggestions check isn't working correctly
- The table empty check is failing
- Some other code path bypasses the confirmation

### 3. `--explain` is not a replacement for `strict`

The deprecation message says "Use 'explain' instead", but:

- `--explain` is a **dry run** that shows SQL and exits
- `strict` was a **confirmation prompt** before execution
- Users must now manually run two commands and visually diff
- There's no atomic "show me what you'll do and let me approve" workflow

### 4. Documentation is outdated

The official docs at still document `strict` as a valid option:
> `strict` - command is used for drizzle-kit push commands and will always ask for your confirmation

The TypeScript types also still include `strict?: boolean` in the Config type.

## Requested Changes

1. **Restore `strict` mode that prompts for ALL changes** - When `strict: true`, the user should see ALL pending schema changes (CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE INDEX, etc.) and must explicitly approve before any are applied. This is critical for production safety.

2. **Warn when deprecated options are used** - Don't silently ignore `strict: true` in config files

3. **Update documentation** - Remove `strict` from docs or clearly mark as deprecated with migration guide

4. **Consider a `--dry-run --confirm` pattern** - Single command that shows changes and prompts for approval

## Workaround

Currently the only workaround is a two-step manual process:

```bash
# Step 1: Preview
drizzle-kit push --explain

# Step 2: Manually review output, then run
drizzle-kit push
```

This is error-prone and doesn't provide the safety of a confirmation prompt.

## Impact

This is a **data safety regression** from 0.x versions. Users upgrading to 1.0 beta who relied on `strict: true` for safety will have destructive operations execute without consent.

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.