Skip to content

Commit 12395e4

Browse files
authored
fix(db-*): disable DB connection for payload migrate:create (#12596)
Fixes #12582
1 parent a17d84e commit 12395e4

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

packages/db-postgres/src/connect.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ export const connect: Connect = async function connect(
5151
) {
5252
const { hotReload } = options
5353

54-
this.schema = {
55-
pgSchema: this.pgSchema,
56-
...this.tables,
57-
...this.relations,
58-
...this.enums,
59-
}
60-
6154
try {
6255
if (!this.pool) {
6356
this.pool = new this.pg.Pool(this.poolOptions)

packages/db-sqlite/src/connect.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ export const connect: Connect = async function connect(
1515
) {
1616
const { hotReload } = options
1717

18-
this.schema = {
19-
...this.tables,
20-
...this.relations,
21-
}
22-
2318
try {
2419
if (!this.client) {
2520
this.client = createClient(this.clientConfig)

packages/db-sqlite/src/init.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ export const init: Init = async function init(this: SQLiteAdapter) {
3636
})
3737

3838
await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })
39+
40+
this.schema = {
41+
...this.tables,
42+
...this.relations,
43+
}
3944
}

packages/db-vercel-postgres/src/connect.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ export const connect: Connect = async function connect(
1616
) {
1717
const { hotReload } = options
1818

19-
this.schema = {
20-
pgSchema: this.pgSchema,
21-
...this.tables,
22-
...this.relations,
23-
...this.enums,
24-
}
25-
2619
try {
2720
const logger = this.logger || false
2821

packages/drizzle/src/postgres/init.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ export const init: Init = async function init(this: BasePostgresAdapter) {
3535
})
3636

3737
await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })
38+
39+
this.schema = {
40+
pgSchema: this.pgSchema,
41+
...this.tables,
42+
...this.relations,
43+
...this.enums,
44+
}
3845
}

packages/payload/src/bin/migrate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const migrate = async ({ config, parsedArgs }: Args): Promise<void> => {
6565
// Barebones instance to access database adapter
6666
await payload.init({
6767
config,
68+
disableDBConnect: args[0] === 'migrate:create',
6869
disableOnInit: true,
6970
...prettySyncLogger,
7071
})

0 commit comments

Comments
 (0)