[#5611] make PRAGMA optimize optional
This commit is contained in:
		
							parent
							
								
									1e480c5380
								
							
						
					
					
						commit
						1f7aba40f0
					
				| 
						 | 
					@ -8,6 +8,8 @@
 | 
				
			||||||
  func(T) error
 | 
					  func(T) error
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Make `PRAGMA optimize` statement optional ([#5611](https://github.com/pocketbase/pocketbase/discussions/5611)).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## v0.23.0-rc2
 | 
					## v0.23.0-rc2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@ package core
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"log/slog"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,7 +146,7 @@ func (app *BaseApp) SyncRecordTableSchema(newCollection *Collection, oldCollecti
 | 
				
			||||||
	// (https://www.sqlite.org/pragma.html#pragma_optimize)
 | 
						// (https://www.sqlite.org/pragma.html#pragma_optimize)
 | 
				
			||||||
	_, optimizeErr := app.DB().NewQuery("PRAGMA optimize").Execute()
 | 
						_, optimizeErr := app.DB().NewQuery("PRAGMA optimize").Execute()
 | 
				
			||||||
	if optimizeErr != nil {
 | 
						if optimizeErr != nil {
 | 
				
			||||||
		return fmt.Errorf("failed to run optimize after the fields changes: %w", optimizeErr)
 | 
							app.Logger().Warn("Failed to run PRAGMA optimize after record table sync", slog.String("error", optimizeErr.Error()))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue