Error when calling drizzle-kit push:pg again

When I call the command for the first time, everything is fine, everything is entered into the database, but if I call it the 2nd time. The following error appears:
drizzle-kit: v0.19.9
drizzle-orm: v0.27.2

No config path provided, using default 'drizzle.config.ts'
Reading config file '.../drizzle.config.ts'
.../node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40646
const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);
^

error: relation "public.verificationtoken" does not exist
at Parser.parseErrorMessage (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40646:98)
at Parser.handlePacket (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40487:25)
at Parser.parse (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40411:34)
at TLSSocket.<anonymous> (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40687:44)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 128,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '1230',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'namespace.c',
line: '428',
routine: 'RangeVarGetRelidExtended'
}
drizzle-kit: v0.19.9
drizzle-orm: v0.27.2

No config path provided, using default 'drizzle.config.ts'
Reading config file '.../drizzle.config.ts'
.../node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40646
const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);
^

error: relation "public.verificationtoken" does not exist
at Parser.parseErrorMessage (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40646:98)
at Parser.handlePacket (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40487:25)
at Parser.parse (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40411:34)
at TLSSocket.<anonymous> (...node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:40687:44)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 128,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '1230',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'namespace.c',
line: '428',
routine: 'RangeVarGetRelidExtended'
}
3 Replies
Vonyc
VonycOP2y ago
config:
/** @internal */
export const users = pgTable("users", {
id: text("id").notNull().primaryKey(),
name: text("name"),
email: text("email").notNull(),
emailVerified: timestamp("emailVerified", { mode: "date" }),
image: text("image"),
})

/** @internal */
export const accounts = pgTable(
"accounts",
{
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
type: text("type").$type<AdapterAccount["type"]>().notNull(),
provider: text("provider").notNull(),
providerAccountId: text("providerAccountId").notNull(),
refresh_token: text("refresh_token"),
access_token: text("access_token"),
created_at: integer("created_at"),
expires_at: integer("expires_at"),
token_type: text("token_type"),
scope: text("scope"),
id_token: text("id_token"),
session_state: text("session_state"),
},
(account) => ({
compoundKey: primaryKey(account.provider, account.providerAccountId),
})
)

/** @internal */
export const sessions = pgTable("sessions", {
sessionToken: text("sessionToken").notNull().primaryKey(),
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
expires: timestamp("expires", { mode: "date" }).notNull(),
})

/** @internal */
export const verificationTokens = pgTable(
"verificationToken",
{
identifier: text("identifier").notNull(),
token: text("token").notNull(),
expires: timestamp("expires", { mode: "date" }).notNull(),
},
(vt) => ({
compoundKey: primaryKey(vt.identifier, vt.token),
})
)

/** @internal */
export const schema = { users, accounts, sessions, verificationTokens }
export type DefaultSchema = typeof schema
/** @internal */
export const users = pgTable("users", {
id: text("id").notNull().primaryKey(),
name: text("name"),
email: text("email").notNull(),
emailVerified: timestamp("emailVerified", { mode: "date" }),
image: text("image"),
})

/** @internal */
export const accounts = pgTable(
"accounts",
{
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
type: text("type").$type<AdapterAccount["type"]>().notNull(),
provider: text("provider").notNull(),
providerAccountId: text("providerAccountId").notNull(),
refresh_token: text("refresh_token"),
access_token: text("access_token"),
created_at: integer("created_at"),
expires_at: integer("expires_at"),
token_type: text("token_type"),
scope: text("scope"),
id_token: text("id_token"),
session_state: text("session_state"),
},
(account) => ({
compoundKey: primaryKey(account.provider, account.providerAccountId),
})
)

/** @internal */
export const sessions = pgTable("sessions", {
sessionToken: text("sessionToken").notNull().primaryKey(),
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
expires: timestamp("expires", { mode: "date" }).notNull(),
})

/** @internal */
export const verificationTokens = pgTable(
"verificationToken",
{
identifier: text("identifier").notNull(),
token: text("token").notNull(),
expires: timestamp("expires", { mode: "date" }).notNull(),
},
(vt) => ({
compoundKey: primaryKey(vt.identifier, vt.token),
})
)

/** @internal */
export const schema = { users, accounts, sessions, verificationTokens }
export type DefaultSchema = typeof schema
Andrii Sherman
Hey can you try it with [email protected]?
Vonyc
VonycOP2y ago
@Andrew Sherman Hello, with drizzle-kit: v0.19.12 drizzle-orm: v0.27.2 Everything is working well now. Thank you ❤️ . I close the issue on github
Want results from more Discord servers?
Add your server