You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-12-02 09:31:58 +02:00
skip empty automigrate templates
This commit is contained in:
@@ -17,6 +17,8 @@ const (
|
||||
TemplateLangGo = "go"
|
||||
)
|
||||
|
||||
var emptyTemplateErr = errors.New("empty template")
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// JavaScript templates
|
||||
// -------------------------------------------------------------------
|
||||
@@ -271,6 +273,10 @@ func (p *plugin) jsDiffTemplate(new *models.Collection, old *models.Collection)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
if len(upParts) == 0 && len(downParts) == 0 {
|
||||
return "", emptyTemplateErr
|
||||
}
|
||||
|
||||
up := strings.Join(upParts, "\n ")
|
||||
down := strings.Join(downParts, "\n ")
|
||||
|
||||
@@ -646,6 +652,10 @@ func (p *plugin) goDiffTemplate(new *models.Collection, old *models.Collection)
|
||||
}
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
if len(upParts) == 0 && len(downParts) == 0 {
|
||||
return "", emptyTemplateErr
|
||||
}
|
||||
|
||||
up := strings.Join(upParts, "\n\t\t")
|
||||
down := strings.Join(downParts, "\n\t\t")
|
||||
combined := up + down
|
||||
|
||||
Reference in New Issue
Block a user