drizzle-team / drizzle-team/drizzle-orm

drizzle-kit push adds and removes composite primary keys each time its run

Open
#3,338 8 comments 15 reactions 0 assignees View on GitHub
db/mysql drizzle/kit priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

Even when i dont make any schema changes all of my composite primary keys are removed and added:

```bash
drizzle-kit: v0.23.0
drizzle-orm: v0.31.4

No config path provided, using default path
Reading config file '/Users/jj/Documents/GitHub/fabworkshq/fabworks-v2/packages/db/drizzle.config.ts'
Warning: You need to pass an instance of Client:

import { Client } from "@planetscale/database";

const client = new Client({
host: process.env["DATABASE_HOST"],
username: process.env["DATABASE_USERNAME"],
password: process.env["DATABASE_PASSWORD"],
});

const db = drizzle(client);

Starting from version 0.30.0, you will encounter an error if you attempt to use anything other than a Client instance.
Please make the necessary changes now to prevent any runtime errors in the future

[✓] Pulling schema from database...
Reading schema files:
/Users/jj/Documents/GitHub/fabworkshq/fabworks-v2/packages/db/src/schema/index.ts

Warning You are about to execute current statements:

ALTER TABLE `job_files` DROP PRIMARY KEY;
ALTER TABLE `material_bending` DROP PRIMARY KEY;
ALTER TABLE `materials` DROP PRIMARY KEY;
ALTER TABLE `job_files` ADD PRIMARY KEY(`job_id`,`file_id`);
ALTER TABLE `material_bending` ADD PRIMARY KEY(`type`,`grade`,`thickness`);
ALTER TABLE `materials` ADD PRIMARY KEY(`type`,`grade`,`thickness`);

[✓] Changes applied
```

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.