sqlite multi-statement upgrade fix
This commit is contained in:
		
							parent
							
								
									5d679dbb7a
								
							
						
					
					
						commit
						a67c2b9884
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -54,7 +54,9 @@ export async function upgrade(logger) {
 | 
				
			||||||
      while (version < (sqliteUpdates.length - 1)) {
 | 
					      while (version < (sqliteUpdates.length - 1)) {
 | 
				
			||||||
        version++;
 | 
					        version++;
 | 
				
			||||||
        logger.warn(`Running version ${version} update script (${sqliteUpdates[version]})...`);
 | 
					        logger.warn(`Running version ${version} update script (${sqliteUpdates[version]})...`);
 | 
				
			||||||
        connection.prepare(sqliteUpdates[version]).run();
 | 
					        for (const statement of sqliteUpdates[version].split("\n")) {
 | 
				
			||||||
 | 
					          connection.prepare(statement).run();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      connection.pragma(`user_version = ${version}`); // insecure, but the normal templating method doesn't seem to work here
 | 
					      connection.pragma(`user_version = ${version}`); // insecure, but the normal templating method doesn't seem to work here
 | 
				
			||||||
      connection.prepare("COMMIT").run();
 | 
					      connection.prepare("COMMIT").run();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue