package migrations

import (
	"github.com/pocketbase/pocketbase/core"
	m "github.com/pocketbase/pocketbase/migrations"
)

func init() {
	m.Register(func(app core.App) error {
		jsonData := `[
    {
        "id": "lf06qip3f4d11yk",
        "listRule": "((@request.auth.id != \"\" && trail.author.user = @request.auth.id) || trail.public = true) || author = @request.auth.id || trail.trail_share_via_trail.user ?= @request.auth.id",
        "viewRule": "((@request.auth.id != \"\" && trail.author.user = @request.auth.id) || trail.public = true) || author = @request.auth.id || trail.trail_share_via_trail.user ?= @request.auth.id",
        "createRule": "@request.auth.id != \"\" && (trail.author.user = @request.auth.id || trail.public = true || trail.trail_share_via_trail.user ?= @request.auth.id)",
        "updateRule": "@request.auth.id = author.user",
        "deleteRule": "@request.auth.id = author.user",
        "name": "comments",
        "type": "base",
        "fields": [
            {
                "autogeneratePattern": "[a-z0-9]{15}",
                "hidden": false,
                "id": "text3208210256",
                "max": 15,
                "min": 15,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "0udwb0kl",
                "max": 0,
                "min": 0,
                "name": "text",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "cascadeDelete": true,
                "collectionId": "e864strfxo14pm4",
                "hidden": false,
                "id": "snrlpxar",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "trail",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": false,
                "collectionId": "pbc_1295301207",
                "hidden": false,
                "id": "relation3182418120",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "author",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "autodate2990389176",
                "name": "created",
                "onCreate": true,
                "onUpdate": false,
                "presentable": false,
                "system": false,
                "type": "autodate"
            },
            {
                "hidden": false,
                "id": "autodate3332085495",
                "name": "updated",
                "onCreate": true,
                "onUpdate": true,
                "presentable": false,
                "system": false,
                "type": "autodate"
            }
        ],
        "indexes": [],
        "system": false
    },
    {
        "id": "8obn1ukumze565i",
        "listRule": "@request.auth.id = follower.user.id || @request.auth.id = followee.user.id",
        "viewRule": "@request.auth.id = follower.user.id || @request.auth.id = followee.user.id",
        "createRule": "@request.auth.id = follower.user.id",
        "updateRule": "@request.auth.id = follower.user.id",
        "deleteRule": "@request.auth.id = follower.user.id",
        "name": "follows",
        "type": "base",
        "fields": [
            {
                "autogeneratePattern": "[a-z0-9]{15}",
                "hidden": false,
                "id": "text3208210256",
                "max": 15,
                "min": 15,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "cascadeDelete": true,
                "collectionId": "pbc_1295301207",
                "hidden": false,
                "id": "relation3117812038",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "follower",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": true,
                "collectionId": "pbc_1295301207",
                "hidden": false,
                "id": "relation973442177",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "followee",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "select2063623452",
                "maxSelect": 1,
                "name": "status",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "select",
                "values": [
                    "pending",
                    "accepted"
                ]
            },
            {
                "hidden": false,
                "id": "autodate2990389176",
                "name": "created",
                "onCreate": true,
                "onUpdate": false,
                "presentable": false,
                "system": false,
                "type": "autodate"
            },
            {
                "hidden": false,
                "id": "autodate3332085495",
                "name": "updated",
                "onCreate": true,
                "onUpdate": true,
                "presentable": false,
                "system": false,
                "type": "autodate"
            }
        ],
        "indexes": [],
        "system": false
    },
    {
        "id": "dd2l9a4vxpy2ni8",
        "listRule": "author.user = @request.auth.id || trail.author.user ?= @request.auth.id || trail.public ?= true || \ntrail.trail_share_via_trail.user ?= @request.auth.id",
        "viewRule": "author.user = @request.auth.id || trail.author.user ?= @request.auth.id || trail.public ?= true || \ntrail.trail_share_via_trail.user ?= @request.auth.id",
        "createRule": "@request.auth.id != \"\"",
        "updateRule": "@request.auth.id != \"\" && (trail.author.user = @request.auth.id || author.user = @request.auth.id)",
        "deleteRule": "@request.auth.id != \"\" && (trail.author.user = @request.auth.id || author.user = @request.auth.id)",
        "name": "summit_logs",
        "type": "base",
        "fields": [
            {
                "autogeneratePattern": "[a-z0-9]{15}",
                "hidden": false,
                "id": "text3208210256",
                "max": 15,
                "min": 15,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "hidden": false,
                "id": "gxq1yeld",
                "max": "",
                "min": "",
                "name": "date",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "date"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "0ykzwuia",
                "max": 0,
                "min": 0,
                "name": "text",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "hidden": false,
                "id": "rfwmdcpt",
                "maxSelect": 1,
                "maxSize": 5242880,
                "mimeTypes": null,
                "name": "gpx",
                "presentable": false,
                "protected": false,
                "required": false,
                "system": false,
                "thumbs": null,
                "type": "file"
            },
            {
                "hidden": false,
                "id": "ixnksbkt",
                "maxSelect": 99,
                "maxSize": 20971520,
                "mimeTypes": [
                    "image/jpeg",
                    "image/png",
                    "image/vnd.mozilla.apng",
                    "image/webp",
                    "image/svg+xml",
                    "image/heic",
                    "video/ogg",
                    "video/mp4",
                    "video/webm"
                ],
                "name": "photos",
                "presentable": false,
                "protected": false,
                "required": false,
                "system": false,
                "thumbs": null,
                "type": "file"
            },
            {
                "hidden": false,
                "id": "jovws28m",
                "max": null,
                "min": 0,
                "name": "distance",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "m2kndtwn",
                "max": null,
                "min": 0,
                "name": "elevation_gain",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "uqqo9cws",
                "max": null,
                "min": 0,
                "name": "elevation_loss",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "vwxjsrae",
                "max": null,
                "min": 0,
                "name": "duration",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "cascadeDelete": true,
                "collectionId": "pbc_1295301207",
                "hidden": false,
                "id": "relation3182418120",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "author",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": true,
                "collectionId": "e864strfxo14pm4",
                "hidden": false,
                "id": "relation2993194383",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "trail",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "autodate2990389176",
                "name": "created",
                "onCreate": true,
                "onUpdate": false,
                "presentable": false,
                "system": false,
                "type": "autodate"
            },
            {
                "hidden": false,
                "id": "autodate3332085495",
                "name": "updated",
                "onCreate": true,
                "onUpdate": true,
                "presentable": false,
                "system": false,
                "type": "autodate"
            }
        ],
        "indexes": [],
        "system": false
    },
    {
        "id": "1mns8mlal6uf9ku",
        "listRule": "trail.author.user = @request.auth.id || user = @request.auth.id",
        "viewRule": "trail.author.user = @request.auth.id || user = @request.auth.id",
        "createRule": "trail.author.user = @request.auth.id",
        "updateRule": "trail.author.user = @request.auth.id",
        "deleteRule": "trail.author.user = @request.auth.id",
        "name": "trail_share",
        "type": "base",
        "fields": [
            {
                "autogeneratePattern": "[a-z0-9]{15}",
                "hidden": false,
                "id": "text3208210256",
                "max": 15,
                "min": 15,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "cascadeDelete": true,
                "collectionId": "e864strfxo14pm4",
                "hidden": false,
                "id": "eskurfx6",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "trail",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": true,
                "collectionId": "_pb_users_auth_",
                "hidden": false,
                "id": "yyzimwee",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "user",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "zr7aaqxl",
                "maxSelect": 1,
                "name": "permission",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "select",
                "values": [
                    "view",
                    "edit"
                ]
            },
            {
                "hidden": false,
                "id": "autodate2990389176",
                "name": "created",
                "onCreate": true,
                "onUpdate": false,
                "presentable": false,
                "system": false,
                "type": "autodate"
            },
            {
                "hidden": false,
                "id": "autodate3332085495",
                "name": "updated",
                "onCreate": true,
                "onUpdate": true,
                "presentable": false,
                "system": false,
                "type": "autodate"
            }
        ],
        "indexes": [],
        "system": false
    },
    {
        "id": "e864strfxo14pm4",
        "listRule": "author.user = @request.auth.id || public = true || (@request.auth.id != \"\" && trail_share_via_trail.user ?= @request.auth.id)",
        "viewRule": "author.user = @request.auth.id || public = true || (@request.auth.id != \"\" && trail_share_via_trail.user ?= @request.auth.id)",
        "createRule": "@request.auth.id != \"\" && (@request.body.author.user = @request.auth.id)",
        "updateRule": "author.user = @request.auth.id || (@request.auth.id != \"\" && trail_share_via_trail.trail = id && trail_share_via_trail.user ?= @request.auth.id && trail_share_via_trail.permission = \"edit\")",
        "deleteRule": "author.user = @request.auth.id ",
        "name": "trails",
        "type": "base",
        "fields": [
            {
                "autogeneratePattern": "[a-z0-9]{15}",
                "hidden": false,
                "id": "text3208210256",
                "max": 15,
                "min": 15,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "wquvuytd",
                "max": 0,
                "min": 0,
                "name": "name",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": true,
                "system": false,
                "type": "text"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "6kkucam1",
                "max": 10000,
                "min": 0,
                "name": "description",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "8x74ba26",
                "max": 0,
                "min": 0,
                "name": "location",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "hidden": false,
                "id": "ehrmydva",
                "name": "public",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "bool"
            },
            {
                "hidden": false,
                "id": "epgmtyxy",
                "max": null,
                "min": 0,
                "name": "distance",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "5wxdt3aj",
                "max": null,
                "min": null,
                "name": "elevation_gain",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "xutbwpq4",
                "max": null,
                "min": null,
                "name": "elevation_loss",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "ukr9rqz4",
                "max": null,
                "min": 0,
                "name": "duration",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "eqeqja1s",
                "max": null,
                "min": null,
                "name": "lat",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "y6dbfyw6",
                "max": null,
                "min": null,
                "name": "lon",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "aqbpyawe",
                "maxSelect": 99,
                "maxSize": 20971520,
                "mimeTypes": [
                    "image/jpeg",
                    "image/vnd.mozilla.apng",
                    "image/png",
                    "image/webp",
                    "image/svg+xml",
                    "image/heic",
                    "video/mp4",
                    "video/webm",
                    "video/ogg"
                ],
                "name": "photos",
                "presentable": false,
                "protected": false,
                "required": false,
                "system": false,
                "thumbs": null,
                "type": "file"
            },
            {
                "hidden": false,
                "id": "k8xdrsyv",
                "maxSelect": 1,
                "maxSize": 5242880,
                "mimeTypes": null,
                "name": "gpx",
                "presentable": false,
                "protected": false,
                "required": false,
                "system": false,
                "thumbs": null,
                "type": "file"
            },
            {
                "cascadeDelete": false,
                "collectionId": "kjxvi8asj2igqwf",
                "hidden": false,
                "id": "b49obm5u",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "category",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": false,
                "collectionId": "pbc_1219621782",
                "hidden": false,
                "id": "relation1874629670",
                "maxSelect": 999,
                "minSelect": 0,
                "name": "tags",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": true,
                "collectionId": "pbc_1295301207",
                "hidden": false,
                "id": "relation3182418120",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "author",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "cascadeDelete": false,
                "collectionId": "goeo2ubp103rzp9",
                "hidden": false,
                "id": "ppq2sist",
                "maxSelect": 2147483647,
                "minSelect": 0,
                "name": "waypoints",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "k2giqyjq",
                "max": null,
                "min": null,
                "name": "thumbnail",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "dywtnynw",
                "maxSelect": 1,
                "name": "difficulty",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "select",
                "values": [
                    "easy",
                    "moderate",
                    "difficult"
                ]
            },
            {
                "hidden": false,
                "id": "hovyvbtt",
                "max": "",
                "min": "",
                "name": "date",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "date"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "sajmiuau",
                "max": 0,
                "min": 0,
                "name": "external_id",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "hidden": false,
                "id": "htr35nha",
                "maxSelect": 1,
                "name": "external_provider",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "select",
                "values": [
                    "strava",
                    "komoot"
                ]
            },
            {
                "hidden": false,
                "id": "autodate2990389176",
                "name": "created",
                "onCreate": true,
                "onUpdate": false,
                "presentable": false,
                "system": false,
                "type": "autodate"
            },
            {
                "hidden": false,
                "id": "autodate3332085495",
                "name": "updated",
                "onCreate": true,
                "onUpdate": true,
                "presentable": false,
                "system": false,
                "type": "autodate"
            }
        ],
        "indexes": [],
        "system": false
    },
    {
        "id": "goeo2ubp103rzp9",
        "listRule": "author = @request.auth.id || trails_via_waypoints.author.user ?= @request.auth.id || trails_via_waypoints.public ?= true || \n(@collection.trail_share.trail.id ?= trails_via_waypoints.id && @collection.trail_share.user ?= @request.auth.id)",
        "viewRule": "author = @request.auth.id || trails_via_waypoints.author.user ?= @request.auth.id || trails_via_waypoints.public ?= true || \n(@collection.trail_share.trail.id ?= trails_via_waypoints.id && @collection.trail_share.user ?= @request.auth.id)",
        "createRule": "@request.auth.id != \"\"",
        "updateRule": "@request.auth.id != \"\" && ((@collection.trails.waypoints.id ?= id && @collection.trails.author.user = @request.auth.id) || author = @request.auth.id)",
        "deleteRule": "@request.auth.id != \"\" && ((@collection.trails.waypoints.id ?= id && @collection.trails.author.user = @request.auth.id) || author = @request.auth.id)",
        "name": "waypoints",
        "type": "base",
        "fields": [
            {
                "autogeneratePattern": "[a-z0-9]{15}",
                "hidden": false,
                "id": "text3208210256",
                "max": 15,
                "min": 15,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "2yegzjtk",
                "max": 0,
                "min": 0,
                "name": "name",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "3xtcjtxv",
                "max": 0,
                "min": 0,
                "name": "description",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "hidden": false,
                "id": "ygotgxzy",
                "max": null,
                "min": null,
                "name": "lat",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "q0ygnxd2",
                "max": null,
                "min": null,
                "name": "lon",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "hidden": false,
                "id": "s1prb3fx",
                "max": null,
                "min": 0,
                "name": "distance_from_start",
                "onlyInt": false,
                "presentable": false,
                "required": false,
                "system": false,
                "type": "number"
            },
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "rnjgm2tk",
                "max": 0,
                "min": 0,
                "name": "icon",
                "pattern": "",
                "presentable": false,
                "primaryKey": false,
                "required": false,
                "system": false,
                "type": "text"
            },
            {
                "hidden": false,
                "id": "tfhs3juh",
                "maxSelect": 99,
                "maxSize": 20971520,
                "mimeTypes": [
                    "image/jpeg",
                    "image/png",
                    "image/vnd.mozilla.apng",
                    "image/webp",
                    "image/svg+xml",
                    "video/ogg",
                    "video/mp4",
                    "video/webm"
                ],
                "name": "photos",
                "presentable": false,
                "protected": false,
                "required": false,
                "system": false,
                "thumbs": null,
                "type": "file"
            },
            {
                "cascadeDelete": true,
                "collectionId": "_pb_users_auth_",
                "hidden": false,
                "id": "8qbxrsd8",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "author",
                "presentable": false,
                "required": true,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "autodate2990389176",
                "name": "created",
                "onCreate": true,
                "onUpdate": false,
                "presentable": false,
                "system": false,
                "type": "autodate"
            },
            {
                "hidden": false,
                "id": "autodate3332085495",
                "name": "updated",
                "onCreate": true,
                "onUpdate": true,
                "presentable": false,
                "system": false,
                "type": "autodate"
            }
        ],
        "indexes": [],
        "system": false
    },
    {
        "id": "urytyc428mwlbqq",
        "listRule": null,
        "viewRule": "@request.auth.id = user",
        "createRule": null,
        "updateRule": null,
        "deleteRule": null,
        "name": "trails_bounding_box",
        "type": "view",
        "fields": [
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "text3208210256",
                "max": 0,
                "min": 0,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "cascadeDelete": true,
                "collectionId": "_pb_users_auth_",
                "hidden": false,
                "id": "_clone_7E6L",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "user",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "json2217363417",
                "maxSize": 1,
                "name": "max_lat",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json3888878381",
                "maxSize": 1,
                "name": "max_lon",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json2279188374",
                "maxSize": 1,
                "name": "min_lat",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json3828904802",
                "maxSize": 1,
                "name": "min_lon",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            }
        ],
        "indexes": [],
        "system": false,
        "viewQuery": "SELECT \n    activitypub_actors.id, activitypub_actors.user, \n    COALESCE(MAX(trails.lat), 0) AS max_lat, \n    COALESCE(MAX(trails.lon), 0) AS max_lon, \n    COALESCE(MIN(trails.lat), 0) AS min_lat, \n    COALESCE(MIN(trails.lon), 0) AS min_lon \nFROM activitypub_actors \nLEFT JOIN trails \n    ON activitypub_actors.id = trails.author \n    OR trails.public = TRUE \n    OR EXISTS (\n        SELECT 1 \n        FROM trail_share \n        WHERE trail_share.trail = trails.id \n        AND trail_share.user = activitypub_actors.id\n    ) \nGROUP BY activitypub_actors.id;"
    },
    {
        "id": "4wbv9tz5zjdrjh1",
        "listRule": null,
        "viewRule": "@request.auth.id = user",
        "createRule": null,
        "updateRule": null,
        "deleteRule": null,
        "name": "trails_filter",
        "type": "view",
        "fields": [
            {
                "autogeneratePattern": "",
                "hidden": false,
                "id": "text3208210256",
                "max": 0,
                "min": 0,
                "name": "id",
                "pattern": "^[a-z0-9]+$",
                "presentable": false,
                "primaryKey": true,
                "required": true,
                "system": true,
                "type": "text"
            },
            {
                "cascadeDelete": true,
                "collectionId": "_pb_users_auth_",
                "hidden": false,
                "id": "_clone_FrMO",
                "maxSelect": 1,
                "minSelect": 0,
                "name": "user",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "relation"
            },
            {
                "hidden": false,
                "id": "json1840770130",
                "maxSize": 1,
                "name": "max_distance",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json2471616556",
                "maxSize": 1,
                "name": "max_elevation_gain",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json2649087013",
                "maxSize": 1,
                "name": "max_elevation_loss",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json4152030739",
                "maxSize": 1,
                "name": "max_duration",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json4257545400",
                "maxSize": 1,
                "name": "min_distance",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json3237476552",
                "maxSize": 1,
                "name": "min_elevation_gain",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json3460547777",
                "maxSize": 1,
                "name": "min_elevation_loss",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            },
            {
                "hidden": false,
                "id": "json1728702201",
                "maxSize": 1,
                "name": "min_duration",
                "presentable": false,
                "required": false,
                "system": false,
                "type": "json"
            }
        ],
        "indexes": [],
        "system": false,
        "viewQuery": "SELECT activitypub_actors.id, activitypub_actors.user, COALESCE(printf(\"%.2f\", MAX(trails.distance)), 0) AS max_distance,\n  COALESCE(printf(\"%.2f\", MAX(trails.elevation_gain)), 0) AS max_elevation_gain, \n  COALESCE(printf(\"%.2f\", MAX(trails.elevation_loss)), 0) AS max_elevation_loss, \n  COALESCE(printf(\"%.2f\", MAX(trails.duration)), 0) AS max_duration, \n  COALESCE(printf(\"%.2f\", MIN(trails.distance)), 0) AS min_distance,   \n  COALESCE(printf(\"%.2f\", MIN(trails.elevation_gain)), 0) AS min_elevation_gain, \n  COALESCE(printf(\"%.2f\", MIN(trails.elevation_loss)), 0) AS min_elevation_loss, \n  COALESCE(printf(\"%.2f\", MIN(trails.duration)), 0) AS min_duration \nFROM activitypub_actors \n  LEFT JOIN trails ON \n  activitypub_actors.id = trails.author OR \n  trails.public = 1 OR \n  EXISTS (\n    SELECT 1 \n    FROM trail_share \n    WHERE trail_share.trail = trails.id \n    AND trail_share.user = activitypub_actors.user\n  ) GROUP BY activitypub_actors.id;"
    }
]`

		return app.ImportCollectionsByMarshaledJSON([]byte(jsonData), false)
	}, func(app core.App) error {
		return nil
	})
}
