Fix auto migrations

This commit is contained in:
Piotr Rogowski 2023-11-20 12:22:55 +01:00
parent 7225c76f05
commit d8a04f8f5f
No known key found for this signature in database
GPG Key ID: 4A842D702D9C6F8F
4 changed files with 28 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package migrations
import (
"encoding/json"
"fmt"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
@ -11,6 +12,14 @@ import (
func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db);
_, err := dao.FindCollectionByNameOrId("9eif9v40b0uw9l8")
if err == nil {
fmt.Println("collection iniFiles already exists")
return nil
}
jsonData := `{
"id": "9eif9v40b0uw9l8",
"created": "2023-11-20 10:50:08.919Z",

View File

@ -2,6 +2,7 @@ package migrations
import (
"encoding/json"
"fmt"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
@ -11,6 +12,14 @@ import (
func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db);
_, err := dao.FindCollectionByNameOrId("9eif9v40b0uw9l8")
if err == nil {
fmt.Println("collection stargazers already exists")
return nil
}
jsonData := `{
"id": "z8cojwcvlyxxyll",
"created": "2023-11-20 10:50:08.921Z",

View File

@ -2,6 +2,7 @@ package migrations
import (
"encoding/json"
"fmt"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
@ -11,6 +12,14 @@ import (
func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db);
_, err := dao.FindCollectionByNameOrId("9eif9v40b0uw9l8")
if err == nil {
fmt.Println("collection tunes already exists")
return nil
}
jsonData := `{
"id": "5djmpehuiigg06b",
"created": "2023-11-20 10:50:08.921Z",

View File

@ -14,7 +14,7 @@ func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db);
collection, err := dao.FindCollectionByNameOrId("_pb_users_auth_")
collection, err := dao.FindCollectionByNameOrId("users")
if err != nil {
return err
}