Skip to content

Commit

Permalink
fix(drizzle-kit/bin): CHAR SQL type error on RDS
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRusakov authored Nov 7, 2024
1 parent df15808 commit 9126b63
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drizzle-kit/src/cli/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export const preparePostgresDB = async (
return result as any[];
};
const proxy = async (params: ProxyParams) => {
params.sql = params.sql.replace(/a.attidentity AS identity_type/i, 'a.attidentity::text AS identity_type');
params.sql = params.sql.replace(/a.attgenerated AS generated_type/i, 'a.attgenerated::text AS generated_type');

const prepared = session.prepareQuery<
PreparedQueryConfig & {
execute: AwsDataApiPgQueryResult<unknown>;
Expand Down Expand Up @@ -130,6 +133,9 @@ export const preparePostgresDB = async (
};

const proxy = async (params: ProxyParams) => {
params.sql = params.sql.replace(/a.attidentity AS identity_type/i, 'a.attidentity::text AS identity_type');
params.sql = params.sql.replace(/a.attgenerated AS generated_type/i, 'a.attgenerated::text AS generated_type');

const preparedParams = preparePGliteParams(params.params);
const result = await pglite.query(params.sql, preparedParams, {
rowMode: params.mode,
Expand Down Expand Up @@ -246,6 +252,9 @@ export const preparePostgresDB = async (
};

const proxy = async (params: ProxyParams) => {
params.sql = params.sql.replace(/a.attidentity AS identity_type/i, 'a.attidentity::text AS identity_type');
params.sql = params.sql.replace(/a.attgenerated AS generated_type/i, 'a.attgenerated::text AS generated_type');

if (params.mode === 'object') {
return await client.unsafe(params.sql, params.params);
}
Expand Down

0 comments on commit 9126b63

Please sign in to comment.