You've already forked pocketbase
							
							
				mirror of
				https://github.com/pocketbase/pocketbase.git
				synced 2025-10-31 08:37:38 +02:00 
			
		
		
		
	[#53] fix migrations register in framework mode
This commit is contained in:
		| @@ -3,6 +3,8 @@ package migrations | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"path/filepath" | ||||
| 	"runtime" | ||||
|  | ||||
| 	"github.com/pocketbase/dbx" | ||||
| 	"github.com/pocketbase/pocketbase/daos" | ||||
| @@ -20,7 +22,14 @@ func Register( | ||||
| 	down func(db dbx.Builder) error, | ||||
| 	optFilename ...string, | ||||
| ) { | ||||
| 	AppMigrations.Register(up, down, optFilename...) | ||||
| 	var optFiles []string | ||||
| 	if len(optFilename) > 0 { | ||||
| 		optFiles = optFilename | ||||
| 	} else { | ||||
| 		_, path, _, _ := runtime.Caller(1) | ||||
| 		optFiles = append(optFiles, filepath.Base(path)) | ||||
| 	} | ||||
| 	AppMigrations.Register(up, down, optFiles...) | ||||
| } | ||||
|  | ||||
| func init() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user