graphql-migrate
graphql-migrate copied to clipboard
Check PG version / support for PG v12
Hey, I just tried to use this and got this error:
{
method: 'raw',
sql: 'select\n' +
' c.conname as "indexName",\n' +
` array_to_string(array_agg(a.attname), ',') as "columnNames",\n` +
' c.consrc as "expression"\n' +
' from\n' +
' pg_class t,\n' +
' pg_constraint c,\n' +
' pg_namespace n,\n' +
' pg_attribute a\n' +
' where\n' +
' c.conrelid = t.oid\n' +
' and n.oid = c.connamespace\n' +
' and a.attrelid = t.oid\n' +
' and a.attnum = ANY(c.conkey)\n' +
" and c.contype = 'c'\n" +
' and t.relname = ?\n' +
' and n.nspname = ?\n' +
' group by\n' +
' t.relname,\n' +
' c.conname,\n' +
' c.consrc;',
bindings: [ 'drink', 'public' ],
options: {},
__knexQueryUid: '7945a2dd-19ff-40b0-9ed5-e8d00d48152f'
}
Error migrating: error: column c.consrc does not exist
at Parser.parseErrorMessage (/my/cool/project/node_modules/pg-protocol/src/parser.ts:325:11)
at Parser.handlePacket (/my/cool/project/node_modules/pg-protocol/src/parser.ts:154:21)
at Parser.parse (/my/cool/project/node_modules/pg-protocol/src/parser.ts:106:30)
at Socket.<anonymous> (/my/cool/project/node_modules/pg-protocol/src/index.ts:7:48)
at Socket.emit (events.js:310:20)
at addChunk (_stream_readable.js:286:12)
at readableAddChunk (_stream_readable.js:268:9)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
length: 187,
severity: 'ERROR',
code: '42703',
detail: undefined,
hint: 'Perhaps you meant to reference the column "c.conkey" or the column "c.conbin".',
position: '107',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '3377',
routine: 'errorMissingColumn'
}
After a little research I noticed this seems to be a problem with the upgrade of postgres v11 -> v12. Preferably you'd support v12, but it might be better to just check the version to give a more descriptive error message.