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
|
const { hotReload } = options
|
||||||
|
|
||||||
this.schema = {
|
|
||||||
pgSchema: this.pgSchema,
|
|
||||||
...this.tables,
|
|
||||||
...this.relations,
|
|
||||||
...this.enums,
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!this.pool) {
|
if (!this.pool) {
|
||||||
this.pool = new this.pg.Pool(this.poolOptions)
|
this.pool = new this.pg.Pool(this.poolOptions)
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ export const connect: Connect = async function connect(
|
|||||||
) {
|
) {
|
||||||
const { hotReload } = options
|
const { hotReload } = options
|
||||||
|
|
||||||
this.schema = {
|
|
||||||
...this.tables,
|
|
||||||
...this.relations,
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!this.client) {
|
if (!this.client) {
|
||||||
this.client = createClient(this.clientConfig)
|
this.client = createClient(this.clientConfig)
|
||||||
|
|||||||
@@ -36,4 +36,9 @@ export const init: Init = async function init(this: SQLiteAdapter) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })
|
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
|
const { hotReload } = options
|
||||||
|
|
||||||
this.schema = {
|
|
||||||
pgSchema: this.pgSchema,
|
|
||||||
...this.tables,
|
|
||||||
...this.relations,
|
|
||||||
...this.enums,
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const logger = this.logger || false
|
const logger = this.logger || false
|
||||||
|
|
||||||
|
|||||||
@@ -35,4 +35,11 @@ export const init: Init = async function init(this: BasePostgresAdapter) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })
|
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
|
// Barebones instance to access database adapter
|
||||||
await payload.init({
|
await payload.init({
|
||||||
config,
|
config,
|
||||||
|
disableDBConnect: args[0] === 'migrate:create',
|
||||||
disableOnInit: true,
|
disableOnInit: true,
|
||||||
...prettySyncLogger,
|
...prettySyncLogger,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user