This commit is contained in:
dql
2026-01-20 14:56:01 +08:00
committed by GitHub
parent a9464e6f2e
commit db347bb1b8
8 changed files with 38 additions and 9 deletions
+7 -3
View File
@@ -8,6 +8,7 @@ import (
"regexp"
"strings"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
"github.com/samber/lo"
@@ -18,7 +19,10 @@ import (
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1757476800_m0.4.0_migrate.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1757476800_m0.4.0_migrate.go"}).
One(&struct{}{}); err == nil {
return nil
}
@@ -1375,10 +1379,10 @@ func init() {
app.DB().NewQuery(`UPDATE workflow_run SET graph=REPLACE(graph, '"id":"_', '"id":"')`).Execute()
app.DB().NewQuery(`UPDATE workflow_output SET nodeId=SUBSTR(nodeId, 2) WHERE nodeId LIKE '-%'`).Execute()
app.DB().NewQuery(`UPDATE workflow_output SET nodeId=SUBSTR(nodeId, 2) WHERE nodeId LIKE '_%'`).Execute()
app.DB().NewQuery(`UPDATE workflow_output SET nodeId=SUBSTR(nodeId, 2) WHERE nodeId LIKE '\_%' ESCAPE '\'`).Execute()
app.DB().NewQuery(`UPDATE workflow_logs SET nodeId=SUBSTR(nodeId, 2) WHERE nodeId LIKE '-%'`).Execute()
app.DB().NewQuery(`UPDATE workflow_logs SET nodeId=SUBSTR(nodeId, 2) WHERE nodeId LIKE '_%'`).Execute()
app.DB().NewQuery(`UPDATE workflow_logs SET nodeId=SUBSTR(nodeId, 2) WHERE nodeId LIKE '\_%' ESCAPE '\'`).Execute()
}
}
+5 -1
View File
@@ -4,13 +4,17 @@ import (
"os"
"strings"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1757476801_m0.4.0_initialize.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1757476801_m0.4.0_initialize.go"}).
One(&struct{}{}); err == nil {
return nil
}
+5 -1
View File
@@ -1,6 +1,7 @@
package migrations
import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
@@ -9,7 +10,10 @@ import (
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1760486400_m0.4.1.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1760486400_m0.4.1.go"}).
One(&struct{}{}); err == nil {
return nil
}
+5 -1
View File
@@ -1,6 +1,7 @@
package migrations
import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
@@ -9,7 +10,10 @@ import (
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1762142400_m0.4.3.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1762142400_m0.4.3.go"}).
One(&struct{}{}); err == nil {
return nil
}
+5 -1
View File
@@ -1,13 +1,17 @@
package migrations
import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1762516800_app_v0.4.4.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1762516800_m0.4.4.go"}).
One(&struct{}{}); err == nil {
return nil
}
+5 -1
View File
@@ -1,6 +1,7 @@
package migrations
import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
@@ -9,7 +10,10 @@ import (
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1763373600_m0.4.5.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1763373600_m0.4.5.go"}).
One(&struct{}{}); err == nil {
return nil
}
+5 -1
View File
@@ -1,6 +1,7 @@
package migrations
import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
@@ -9,7 +10,10 @@ import (
func init() {
m.Register(func(app core.App) error {
if mr, _ := app.FindFirstRecordByFilter("_migrations", "file='1763640000_m0.4.6.go'"); mr != nil {
if err := app.DB().
NewQuery("SELECT (1) FROM _migrations WHERE file={:file} LIMIT 1").
Bind(dbx.Params{"file": "1763640000_m0.4.6.go"}).
One(&struct{}{}); err == nil {
return nil
}
+1
View File
@@ -142,6 +142,7 @@ func init() {
"1762142400_m0.4.3.go",
"1762516800_m0.4.4.go",
"1763373600_m0.4.5.go",
"1763553600_m0.4.6.go",
"1763640000_m0.4.6.go",
}
for _, name := range migrations {