fix(db-postgres): proper migrations table detection query (#7436)

Fixes postgres sql query to detect migrations table.

`error: syntax error at or near "exists"`
This commit is contained in:
Elliot DeNolf
2024-07-30 11:38:28 -04:00
committed by GitHub
parent 6f5cf5d916
commit b5b2bb1907

View File

@@ -5,7 +5,7 @@ export const migrationTableExists = async (adapter: DrizzleAdapter): Promise<boo
if (adapter.name === 'postgres') { if (adapter.name === 'postgres') {
const prependSchema = adapter.schemaName ? `"${adapter.schemaName}".` : '' const prependSchema = adapter.schemaName ? `"${adapter.schemaName}".` : ''
statement = `SELECT to_regclass('${prependSchema}"payload_migrations"') exists;` statement = `SELECT to_regclass('${prependSchema}"payload_migrations"') AS exists;`
} }
if (adapter.name === 'sqlite') { if (adapter.name === 'sqlite') {