You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this case where i won't have direct access to DB anymore because everything is running on Kubernetes.
Before build starts K8 will run npm run db:generate && npm run db:migrate each time new commit is added
Right now I'm getting failed, i assume its because the tables already are there.
What is the best way to fix this? Maybe just overide the tables?
> db:migrate
> drizzle-kit migrate
No config path provided, using default 'drizzle.config.ts'
Reading config file '/workspace/drizzle.config.ts'
[[email protected]] injecting env (0) from .env -- tip: ⚙️ enable debug logging with { debug: true }
Using 'pg' driver for database querying
DrizzleQueryError: Failed query: CREATE TABLE "auth_accounts" (
"id" text PRIMARY KEY NOT NULL,
"account_id" text NOT NULL,
"provider_id" text NOT NULL,
"user_id" text NOT NULL,
"access_token" text,
"refresh_token" text,
"id_token" text,
"access_token_expires_at" timestamp,
"refresh_token_expires_at" timestamp,
"scope" text,
"password" text,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
params:
at NodePgPreparedQuery.queryWithCache (/workspace/node_modules/src/pg-core/session.ts:73:11)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async <anonymous> (/workspace/node_modules/src/pg-core/dialect.ts:102:7)
... 2 lines matching cause stack trace ...
at async migrate (/workspace/node_modules/src/node-postgres/migrator.ts:10:2) {
query: 'CREATE TABLE "auth_accounts" (\n' +
'\t"id" text PRIMARY KEY NOT NULL,\n' +
'\t"account_id" text NOT NULL,\n' +
'\t"provider_id" text NOT NULL,\n' +
'\t"user_id" text NOT NULL,\n' +
'\t"access_token" text,\n' +
'\t"refresh_token" text,\n' +
'\t"id_token" text,\n' +
'\t"access_token_expires_at" timestamp,\n' +
'\t"refresh_token_expires_at" timestamp,\n' +
'\t"scope" text,\n' +
'\t"password" text,\n' +
'\t"created_at" timestamp NOT NULL,\n' +
'\t"updated_at" timestamp NOT NULL\n' +
');\n',
params: [],
cause: error: relation "auth_accounts" already exists
at /workspace/node_modules/pg/lib/client.js:545:17
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async <anonymous> (/workspace/node_modules/src/node-postgres/session.ts:149:14)
at async NodePgPreparedQuery.queryWithCache (/workspace/node_modules/src/pg-core/session.ts:71:12)
at async <anonymous> (/workspace/node_modules/src/pg-core/dialect.ts:102:7)
at async NodePgSession.transaction (/workspace/node_modules/src/node-postgres/session.ts:258:19)
at async PgDialect.migrate (/workspace/node_modules/src/pg-core/dialect.ts:95:3)
at async migrate (/workspace/node_modules/src/node-postgres/migrator.ts:10:2) {
length: 107,
severity: 'ERROR',
code: '42P07',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'heap.c',
line: '1160',
routine: 'heap_create_with_catalog'
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have this case where i won't have direct access to DB anymore because everything is running on Kubernetes.
Before build starts K8 will run
npm run db:generate && npm run db:migrate
each time new commit is addedRight now I'm getting failed, i assume its because the tables already are there.
What is the best way to fix this? Maybe just overide the tables?
Beta Was this translation helpful? Give feedback.
All reactions