fix(db-*): disable DB connection for payload migrate:create (#12596)
Fixes https://github.com/payloadcms/payload/issues/12582
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user