-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report hasn't been filed before.
- I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm
are you using?
0.44.5
What version of drizzle-kit
are you using?
0.31.5
Other packages
No response
Describe the Bug
Considering this given table:
import { sql } from "drizzle-orm";
import { pgTable, uuid } from "drizzle-orm/pg-core";
export const tests = pgTable("tests", {
id: uuid("id").primaryKey().default(sql`uuidv7()`),
});
And this config:
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "postgresql",
schema: "./index.ts",
dbCredentials: {
url: "postgresql://postgres:password@localhost:63104/postgres",
ssl: false,
},
strict: true,
verbose: true,
});
If you run the push
command, it prints this log, which is OK:
[✓] Pulling schema from database...
Warning You are about to execute current statements:
CREATE TABLE "tests" (
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL
);
[✓] Changes applied
But, if you run push
again without making any changes to the schema, instead of telling you there're no changes to be pushed, it prints the following SQL:
ALTER TABLE "tests" DROP CONSTRAINT "tests_id_not_null";
And of course it fails:
789 | query.execute()
790 | }
791 |
792 | function ErrorResponse(x) {
793 | query && (query.cursorFn || query.describeFirst) && write(Sync)
794 | const error = Errors.postgres(parseError(x))
^
PostgresError: column "id" is in a primary key
severity_local: "ERROR",
severity: "ERROR",
file: "tablecmds.c",
routine: "dropconstraint_internal",
code: "42P16"
zhelezkov and enesdir
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working