drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
291 stars 17 forks source link

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

Open CptJJ opened 1 month ago

CptJJ commented 1 month ago

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

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
williamneves commented 1 month ago

Any update on this one?

sbbu commented 3 days ago

Having the same issue.