perf(db-postgres): do not push database schema if not changed (#10155)

Based on https://github.com/payloadcms/payload/pull/10154

If the actual database schema is not changed (no new columns, enums,
indexes, tables) - skip calling Drizzle push. This, potentially can
significantly reduce overhead on reloads in development mode especially
when using remote databases.

If for whatever reason you need to preserve the current behavior you can
use `PAYLOAD_FORCE_DRIZZLE_PUSH=true` env flag.
This commit is contained in:
Sasha
2024-12-27 17:12:01 +02:00
committed by GitHub
parent 374b79d218
commit 98666eb016
2 changed files with 35 additions and 1 deletions

View File

@@ -952,6 +952,10 @@ describe('database', () => {
})
describe('drizzle: schema hooks', () => {
beforeAll(() => {
process.env.PAYLOAD_FORCE_DRIZZLE_PUSH = 'true'
})
it('should add tables with hooks', async () => {
// eslint-disable-next-line jest/no-conditional-in-test
if (payload.db.name === 'mongoose') {