db-migrate/pg

BUG: Support for Postgres 15

Closed this issue · 2 comments

The library errors as follows:

users_db_1   | 2023-01-26 17:47:59.294 UTC [76] ERROR:  permission denied for schema public at character 28                                                                              
users_db_1   | 2023-01-26 17:47:59.294 UTC [76] STATEMENT:  CREATE TABLE IF NOT EXISTS "migrations_state" ("key" VARCHAR  PRIMARY KEY NOT NULL UNIQUE, "value" TEXT  NOT NULL, "run_on" T
IMESTAMP  NOT NULL)                                                                                                                                                                      
turnstile_1  | [ERROR] unhandledRejection                                                                                                                                                
turnstile_1  | [ERROR] error: permission denied for schema public                                                                                                                        
turnstile_1  |     at Parser.parseErrorMessage (/opt/app/node_modules/pg-protocol/dist/parser.js:287:98)                                                                                 
turnstile_1  |     at Parser.handlePacket (/opt/app/node_modules/pg-protocol/dist/parser.js:126:29)                                                                                      
turnstile_1  |     at Parser.parse (/opt/app/node_modules/pg-protocol/dist/parser.js:39:38)                                                                                              
turnstile_1  |     at Socket.stream.on (/opt/app/node_modules/pg-protocol/dist/index.js:11:42)                                                                                           
turnstile_1  |     at emitOne (events.js:116:13)                                                                                                                                         
turnstile_1  |     at Socket.emit (events.js:211:7)                                                                                                                                      
turnstile_1  |     at addChunk (_stream_readable.js:263:12)                                                                                                                              
turnstile_1  |     at readableAddChunk (_stream_readable.js:250:11)                                                                                                                      
turnstile_1  |     at Socket.Readable.push (_stream_readable.js:208:10)                                                                                                                  
turnstile_1  |     at TCP.onread (net.js:601:20)                                                                                                                                         
turnstile_1  | npm ERR! code ELIFECYCLE                                                                                                                                                  
turnstile_1  | npm ERR! errno 1                                                                                                                                                          
turnstile_1  | npm ERR! turnstile@1.0.0 migrate: `db-migrate "up"`                                                                                                                       
turnstile_1  | npm ERR! Exit status 1                                                                                                                                                    
turnstile_1  | npm ERR!                                                                                                                                                                  
turnstile_1  | npm ERR! Failed at the turnstile@1.0.0 migrate script.                                                                                                                    
turnstile_1  | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                                                                        
turnstile_1  |                                                                                                                                                                           
turnstile_1  | npm ERR! A complete log of this run can be found in:                                                                                                                      
turnstile_1  | npm ERR!     /root/.npm/_logs/2023-01-26T17_47_59_320Z-debug.log   

This error comes from an update in postgres 15 which requires updates to the public schema to be done by a user with particular explicitly-set permissions. Article / postgres documentation.

Stepping back to Postgres 14 fixes this issue but isn't a great long term solution.

feel free to shoot by a PR to fix this, am not on the matter yet what exactly changed in PG 15.

as far as i can see this is a permission problem. not a driver one. closing for now