error: ALTER TYPE ... ADD cannot run inside a transaction block
markhalonen opened this issue ยท 1 comments
markhalonen commented
I have a simple migration that is similar to one I've done before:
-- Enter migration here
--! no-transaction
ALTER TYPE waldo.notification_type ADD VALUE if not exists 'wood_load_new_comment';
I get
๐ Error occurred whilst processing migration
error: ALTER TYPE ... ADD cannot run inside a transaction block
at Parser.parseErrorMessage (/usr/local/lib/node_modules/graphile-migrate/node_modules/pg-protocol/dist/parser.js:287:98)
at Parser.handlePacket (/usr/local/lib/node_modules/graphile-migrate/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/usr/local/lib/node_modules/graphile-migrate/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/usr/local/lib/node_modules/graphile-migrate/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (events.js:376:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Any ideas where to look? I tried graphile-migrate v1.1.0 to no avail, I tried graphile-migrate commit
(instead of watch
) and got same error...
The one that is already committed is:
--! Previous: sha1:73600c31fb9180e5e4cc179401a231bbac831e0f
--! Hash: sha1:38b3824d3382bf6d494c7a8d40424346d4192e62
--! no-transaction
ALTER TYPE waldo.notification_type ADD VALUE if not exists 'wood_load_published';
I am not sure why it's not reading the --! no-transaction
flag...
markhalonen commented
Of course I figured it out right after posting an issue. Turns out the migration should be
--! no-transaction
ALTER TYPE waldo.notification_type ADD VALUE if not exists 'wood_load_new_comment';
(it does not have -- Enter migration here
at the top).