fix(db-*): disable DB connection for payload migrate:create (#12596)

Fixes https://github.com/payloadcms/payload/issues/12582
This commit is contained in:
Sasha
2025-05-29 22:25:54 +03:00
committed by GitHub
parent a17d84e570
commit 12395e497b
6 changed files with 13 additions and 19 deletions

View File

@@ -51,13 +51,6 @@ export const connect: Connect = async function connect(
) {
const { hotReload } = options
this.schema = {
pgSchema: this.pgSchema,
...this.tables,
...this.relations,
...this.enums,
}
try {
if (!this.pool) {
this.pool = new this.pg.Pool(this.poolOptions)

View File

@@ -15,11 +15,6 @@ export const connect: Connect = async function connect(
) {
const { hotReload } = options
this.schema = {
...this.tables,
...this.relations,
}
try {
if (!this.client) {
this.client = createClient(this.clientConfig)

View File

@@ -36,4 +36,9 @@ export const init: Init = async function init(this: SQLiteAdapter) {
})
await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })
this.schema = {
...this.tables,
...this.relations,
}
}

View File

@@ -16,13 +16,6 @@ export const connect: Connect = async function connect(
) {
const { hotReload } = options
this.schema = {
pgSchema: this.pgSchema,
...this.tables,
...this.relations,
...this.enums,
}
try {
const logger = this.logger || false

View File

@@ -35,4 +35,11 @@ export const init: Init = async function init(this: BasePostgresAdapter) {
})
await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })
this.schema = {
pgSchema: this.pgSchema,
...this.tables,
...this.relations,
...this.enums,
}
}

View File

@@ -65,6 +65,7 @@ export const migrate = async ({ config, parsedArgs }: Args): Promise<void> => {
// Barebones instance to access database adapter
await payload.init({
config,
disableDBConnect: args[0] === 'migrate:create',
disableOnInit: true,
...prettySyncLogger,
})