Skip to content

Commit

Permalink
fix: cast table name explicitly when checking for DB data (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr authored Dec 6, 2023
1 parent 0c51e41 commit 2296ff3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/postgres/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export async function databaseHasData(
FROM pg_class c
JOIN pg_namespace s ON s.oid = c.relnamespace
WHERE s.nspname = ${sql.options.connection.search_path}
${ignoreMigrationTables ? sql`AND c.relname NOT LIKE '${tableName}%'` : sql``}
${ignoreMigrationTables ? sql`AND c.relname NOT LIKE ${tableName}::text || '%'` : sql``}
`;
return result.count > 0 && result[0].count > 0;
} catch (error: any) {
Expand Down

0 comments on commit 2296ff3

Please sign in to comment.