Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Development - Broken migration #4004

Closed
MichaelKohler opened this issue Apr 15, 2023 · 1 comment
Closed

[BUG] Development - Broken migration #4004

MichaelKohler opened this issue Apr 15, 2023 · 1 comment
Labels

Comments

@MichaelKohler
Copy link
Member

Describe the bug
Running with a completely fresh created db docker container the migrations are failing at 20230124115524-add-duration-to-clips.ts. That migration was adjusted after the fact, this is why this is not impacting deployment.

[BE] APPLICATION -- listening at http://localhost:9000                                                                                                                         
[BE] APPLICATION -- Maintenance error OperationalError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'IF NOT EXISTS (                                                                                                                                
[BE]       (                                                                                                                                                                   
[BE]         SELECT                                                                                                                                                            
[BE]           NULL                                                                                                                                                            
[BE]         FROM                                                                                                                                                              
[BE]           INF' at line 1                                                                                                                                                  
[BE]     at Query.Sequence._packetToError (/code/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)                                                                  
[BE]     at Query.ErrorPacket (/code/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)                                                                                 
[BE]     at Protocol._parsePacket (/code/node_modules/mysql/lib/protocol/Protocol.js:291:23)                                                                                   
[BE]     at Parser._parsePacket (/code/node_modules/mysql/lib/protocol/Parser.js:433:10)                                                                                       
[BE]     at Parser.write (/code/node_modules/mysql/lib/protocol/Parser.js:43:10)                                                                                               
[BE]     at Protocol.write (/code/node_modules/mysql/lib/protocol/Protocol.js:38:16)                                                                                           
[BE]     at Socket.<anonymous> (/code/node_modules/mysql/lib/Connection.js:88:28)                                                                                              
[BE]     at Socket.<anonymous> (/code/node_modules/mysql/lib/Connection.js:526:10)                                                                                             
[BE]     at Socket.emit (events.js:314:20)                                                                                                                                     
[BE]     at Socket.EventEmitter.emit (domain.js:483:12)                                                                                                                        
[BE]     at addChunk (_stream_readable.js:297:12)                                                                                                                              
[BE]     at readableAddChunk (_stream_readable.js:272:9)                                                                                                                       
[BE]     at Socket.Readable.push (_stream_readable.js:213:10)                                                                                                                  
[BE]     at TCP.onStreamRead (internal/stream_base_commons.js:188:23)                                                                                                          
[BE]     --------------------                                                                                                                                                  
[BE]     at Protocol._enqueue (/code/node_modules/mysql/lib/protocol/Protocol.js:144:48)                                                                                       
[BE]     at Connection.query (/code/node_modules/mysql/lib/Connection.js:198:25)                                                                                               
[BE]     at /code/node_modules/db-migrate-mysql/index.js:371:29                                                                                                                
[BE]     at Promise._execute (/code/node_modules/bluebird/js/release/debuggability.js:384:9)                                                                                   
[BE]     at Promise._resolveFromExecutor (/code/node_modules/bluebird/js/release/promise.js:518:18)                                                                            
[BE]     at new Promise (/code/node_modules/bluebird/js/release/promise.js:103:10)                                                                                             
[BE]     at Object.runSql (/code/node_modules/db-migrate-mysql/index.js:366:12)                                                                                                
[BE]     at Class.exports.up (/code/server/src/lib/model/db/migrations/20230124115524-add-duration-to-clips.ts:2:13)                                                           
[BE]     at Class.<anonymous> (/code/node_modules/db-migrate/lib/skeleton.js:85:43)                                                                                            
[BE]     at Promise._execute (/code/node_modules/bluebird/js/release/debuggability.js:384:9)                                                                                   
[BE]     at Promise._resolveFromExecutor (/code/node_modules/bluebird/js/release/promise.js:518:18)                                                                            
[BE]     at new Promise (/code/node_modules/bluebird/js/release/promise.js:103:10)                                                                                             
[BE]     at Class._up (/code/node_modules/db-migrate/lib/skeleton.js:68:12)                                                                                                    
[BE]     at Class.up (/code/node_modules/db-migrate/lib/skeleton.js:150:17)                                                                                                    
[BE]     at Migrator.up (/code/node_modules/db-migrate/lib/migrator.js:108:14)                                                                                                 
[BE]     at /code/node_modules/db-migrate/lib/migrator.js:237:31 {  
[BE]   cause: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF 
NOT EXISTS (                                                                                                                                                                   
[BE]         (                                                                                                                                                                 
[BE]           SELECT                                                                                                                                                          
[BE]             NULL                                                                                                                                                          
[BE]           FROM                                                                                                                                                            
[BE]             INF' at line 1                                                                                                                                                
[BE]       at Query.Sequence._packetToError (/code/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)                                                                
[BE]       at Query.ErrorPacket (/code/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)                                                                               
[BE]       at Protocol._parsePacket (/code/node_modules/mysql/lib/protocol/Protocol.js:291:23)                                                                                 
[BE]       at Parser._parsePacket (/code/node_modules/mysql/lib/protocol/Parser.js:433:10)                                                                                     
[BE]       at Parser.write (/code/node_modules/mysql/lib/protocol/Parser.js:43:10)                                                                                             
[BE]       at Protocol.write (/code/node_modules/mysql/lib/protocol/Protocol.js:38:16)                                                                                         
[BE]       at Socket.<anonymous> (/code/node_modules/mysql/lib/Connection.js:88:28)                                                                                            
[BE]       at Socket.<anonymous> (/code/node_modules/mysql/lib/Connection.js:526:10)                                                                                           
[BE]       at Socket.emit (events.js:314:20)                                                                                                                                   
[BE]       at Socket.EventEmitter.emit (domain.js:483:12)                                                                                                                      
[BE]       at addChunk (_stream_readable.js:297:12)                                                                                                                            
[BE]       at readableAddChunk (_stream_readable.js:272:9)                                                                                                                     
[BE]       at Socket.Readable.push (_stream_readable.js:213:10)                                                                                                                
[BE]       at TCP.onStreamRead (internal/stream_base_commons.js:188:23)                                                                                                        
[BE]       --------------------                                                                                                                                                
[BE]       at Protocol._enqueue (/code/node_modules/mysql/lib/protocol/Protocol.js:144:48)                                                                                     
[BE]       at Connection.query (/code/node_modules/mysql/lib/Connection.js:198:25)                                                                                             
[BE]       at /code/node_modules/db-migrate-mysql/index.js:371:29                                                                                                              
[BE]       at Promise._execute (/code/node_modules/bluebird/js/release/debuggability.js:384:9)                                                                                 
[BE]       at Promise._resolveFromExecutor (/code/node_modules/bluebird/js/release/promise.js:518:18)                                                                          
[BE]       at new Promise (/code/node_modules/bluebird/js/release/promise.js:103:10)                                                                                           
[BE]       at Object.runSql (/code/node_modules/db-migrate-mysql/index.js:366:12)                                                                                              
[BE]       at Class.exports.up (/code/server/src/lib/model/db/migrations/20230124115524-add-duration-to-clips.ts:2:13)                                                         
[BE]       at Class.<anonymous> (/code/node_modules/db-migrate/lib/skeleton.js:85:43)                                                                                          
[BE]       at Promise._execute (/code/node_modules/bluebird/js/release/debuggability.js:384:9)                                                                                 
[BE]       at Promise._resolveFromExecutor (/code/node_modules/bluebird/js/release/promise.js:518:18)                                                                          
[BE]       at new Promise (/code/node_modules/bluebird/js/release/promise.js:103:10)                                                                                           
[BE]       at Class._up (/code/node_modules/db-migrate/lib/skeleton.js:68:12)                                                                                                  
[BE]       at Class.up (/code/node_modules/db-migrate/lib/skeleton.js:150:17)                                                                                                  
[BE]       at Migrator.up (/code/node_modules/db-migrate/lib/migrator.js:108:14)                                                                                               
[BE]       at /code/node_modules/db-migrate/lib/migrator.js:237:31 {                                                                                                           
[BE]     code: 'ER_PARSE_ERROR',                                                                                                                                               
[BE]     errno: 1064,                                                                                                                                                          
[BE]     sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS (\n"
 +                                                                                                                                                                             
[BE]       '      (\n' +                                                                                                                                                       
[BE]       '        SELECT\n' +                                                                                                                                                
[BE]       '          NULL\n' +                                                                                                                                                
[BE]       '        FROM\n' +                                                                                                                                                  
[BE]       "          INF' at line 1",                                                                                                                                         
[BE]     sqlState: '42000', 
[BE]     index: 0,
[BE]     sql: '\n' +
[BE]       '    IF NOT EXISTS (\n' +
[BE]       '      (\n' +
[BE]       '        SELECT\n' +
[BE]       '          NULL\n' +
[BE]       '        FROM\n' +
[BE]       '          INFORMATION_SCHEMA.COLUMNS\n' +
[BE]       '        WHERE\n' +
[BE]       "          TABLE_NAME = 'clips'\n" +
[BE]       "          AND COLUMN_NAME = 'duration' \n" +
[BE]       '      )\n' +
[BE]       '    ) THEN\n' +
[BE]       '      ALTER TABLE clips\n' +
[BE]       '        ADD COLUMN duration INT NOT NULL DEFAULT 0,\n' +
[BE]       '        ALGORITHM = INPLACE,\n' +
[BE]       '        LOCK = NONE;\n' +
[BE]       '    END IF;\n' +
[BE]       '  '
[BE]   },
[BE]   isOperational: true,
[BE]   code: 'ER_PARSE_ERROR',
[BE]   errno: 1064,
[BE]   sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS (\n" +
[BE]     '      (\n' +
[BE]     '        SELECT\n' +
[BE]     '          NULL\n' +
[BE]     '        FROM\n' +
[BE]     "          INF' at line 1",
[BE]   sqlState: '42000',
[BE]   index: 0,
[BE]   sql: '\n' +
[BE]     '    IF NOT EXISTS (\n' +
[BE]     '      (\n' +
[BE]     '        SELECT\n' +
[BE]     '          NULL\n' +
[BE]     '        FROM\n' +
[BE]     '          INFORMATION_SCHEMA.COLUMNS\n' +
[BE]     '        WHERE\n' +
[BE]     "          TABLE_NAME = 'clips'\n" +
[BE]     "          AND COLUMN_NAME = 'duration' \n" +
[BE]     '      )\n' +
[BE]     '    ) THEN\n' +
[BE]     '      ALTER TABLE clips\n' +
[BE]     '        ADD COLUMN duration INT NOT NULL DEFAULT 0,\n' +
[BE]     '        ALGORITHM = INPLACE,\n' +
[BE]     '        LOCK = NONE;\n' +
[BE]     '    END IF;\n' +
[BE]     '  '
[BE] }
@moz-dfeller
Copy link
Contributor

Fixed by #4005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants