commit migrations

This commit is contained in:
Thomas Camlong
2025-11-28 10:51:48 +01:00
parent 9f41375984
commit bee1eadbda
31 changed files with 1898 additions and 2 deletions

3
web/.gitignore vendored
View File

@@ -48,5 +48,4 @@ next-env.d.ts
# Pocketbase
backend/pocketbase
backend/pb_data
backend/pb_migrations
backend/pb_data

View File

@@ -0,0 +1,99 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"indexes": [
"CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)",
"CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`username`) WHERE `email` != ''",
"CREATE UNIQUE INDEX `idx_xcjpYhojHH` ON `users` (`email`)"
],
"oauth2": {
"mappedFields": {
"name": ""
}
}
}, collection)
// update field
collection.fields.addAt(1, new Field({
"cost": 0,
"hidden": true,
"id": "password901924565",
"max": 0,
"min": 5,
"name": "password",
"pattern": "",
"presentable": false,
"required": true,
"system": true,
"type": "password"
}))
// update field
collection.fields.addAt(3, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1579384326",
"max": 255,
"min": 5,
"name": "username",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"indexes": [
"CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)",
"CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`email`) WHERE `email` != ''"
],
"oauth2": {
"mappedFields": {
"name": "name"
}
}
}, collection)
// update field
collection.fields.addAt(1, new Field({
"cost": 0,
"hidden": true,
"id": "password901924565",
"max": 0,
"min": 8,
"name": "password",
"pattern": "",
"presentable": false,
"required": true,
"system": true,
"type": "password"
}))
// update field
collection.fields.addAt(6, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1579384326",
"max": 255,
"min": 0,
"name": "name",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,36 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(4, new Field({
"exceptDomains": null,
"hidden": false,
"id": "email3885137012",
"name": "email",
"onlyDomains": null,
"presentable": false,
"required": false,
"system": true,
"type": "email"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(4, new Field({
"exceptDomains": null,
"hidden": false,
"id": "email3885137012",
"name": "email",
"onlyDomains": null,
"presentable": false,
"required": true,
"system": true,
"type": "email"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,34 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"authAlert": {
"enabled": false
},
"passwordAuth": {
"identityFields": [
"username"
]
}
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"authAlert": {
"enabled": true
},
"passwordAuth": {
"identityFields": [
"email"
]
}
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,146 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = new Collection({
"createRule": "@request.auth.id = created_by.id || @request.auth.admin = true",
"deleteRule": "@request.auth.id = created_by.id || @request.auth.admin = true",
"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": "text1579384326",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
},
{
"hidden": false,
"id": "file2043772302",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
},
{
"cascadeDelete": false,
"collectionId": "_pb_users_auth_",
"hidden": false,
"id": "relation3725765462",
"maxSelect": 1,
"minSelect": 0,
"name": "created_by",
"presentable": true,
"required": true,
"system": false,
"type": "relation"
},
{
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"waiting_approval",
"approved",
"refused"
]
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text1595063097",
"max": 0,
"min": 0,
"name": "aliases",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text989021800",
"max": 0,
"min": 0,
"name": "categories",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"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"
}
],
"id": "pbc_632646243",
"indexes": [
"CREATE UNIQUE INDEX `idx_vB4iK1BfdV` ON `submission` (`name`)"
],
"listRule": "@request.auth.id = created_by.id || @request.auth.admin = true",
"name": "submission",
"system": false,
"type": "base",
"updateRule": "@request.auth.id = created_by.id || @request.auth.admin = true",
"viewRule": "@request.auth.id = created_by.id || @request.auth.admin = true"
});
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243");
return app.delete(collection);
})

View File

@@ -0,0 +1,34 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"updateRule": "id = @request.auth.id && (@request.body.admin = null || @request.body.admin = admin)"
}, collection)
// add field
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": false,
"system": false,
"type": "bool"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"updateRule": "id = @request.auth.id"
}, collection)
// remove field
collection.fields.removeById("bool2282622326")
return app.save(collection)
})

View File

@@ -0,0 +1,32 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": true,
"system": false,
"type": "bool"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": false,
"system": false,
"type": "bool"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,32 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": false,
"system": false,
"type": "bool"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": true,
"system": false,
"type": "bool"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,28 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// add field
collection.fields.addAt(5, new Field({
"cascadeDelete": true,
"collectionId": "_pb_users_auth_",
"hidden": false,
"id": "relation1319357245",
"maxSelect": 1,
"minSelect": 0,
"name": "approved_by",
"presentable": true,
"required": false,
"system": false,
"type": "relation"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// remove field
collection.fields.removeById("relation1319357245")
return app.save(collection)
})

View File

@@ -0,0 +1,32 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": false,
"required": false,
"system": false,
"type": "bool"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": false,
"system": false,
"type": "bool"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,28 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"indexes": [
"CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)",
"CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`username`) WHERE `email` != ''",
"CREATE UNIQUE INDEX `idx_email_3ug5rzmspg` ON `test` (`email`) WHERE `email` != ''"
]
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"indexes": [
"CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)",
"CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`username`) WHERE `email` != ''",
"CREATE UNIQUE INDEX `idx_xcjpYhojHH` ON `users` (`email`)"
]
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,26 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update collection data
unmarshal({
"indexes": [
"CREATE UNIQUE INDEX `idx_vB4iK1BfdV` ON `submissions` (`name`)"
],
"name": "submissions"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update collection data
unmarshal({
"indexes": [
"CREATE UNIQUE INDEX `idx_vB4iK1BfdV` ON `submission` (`name`)"
],
"name": "submission"
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,78 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// remove field
collection.fields.removeById("text1595063097")
// remove field
collection.fields.removeById("text989021800")
// add field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "json1595063097",
"maxSize": 0,
"name": "aliases",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
// add field
collection.fields.addAt(7, new Field({
"hidden": false,
"id": "json989021800",
"maxSize": 0,
"name": "categories",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// add field
collection.fields.addAt(6, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1595063097",
"max": 0,
"min": 0,
"name": "aliases",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(7, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text989021800",
"max": 0,
"min": 0,
"name": "categories",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// remove field
collection.fields.removeById("json1595063097")
// remove field
collection.fields.removeById("json989021800")
return app.save(collection)
})

View File

@@ -0,0 +1,49 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// remove field
collection.fields.removeById("json989021800")
// update field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "json1595063097",
"maxSize": 0,
"name": "extras",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// add field
collection.fields.addAt(7, new Field({
"hidden": false,
"id": "json989021800",
"maxSize": 0,
"name": "categories",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
// update field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "json1595063097",
"maxSize": 0,
"name": "aliases",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,22 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"createRule": "@request.body.admin = false || @request.body.admin = null",
"updateRule": "id = @request.auth.id && (@request.body.admin = false || @request.body.admin = admin)"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"createRule": "",
"updateRule": "id = @request.auth.id && (@request.body.admin = null || @request.body.admin = admin)"
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,44 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"refused",
"pending"
]
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"waiting_approval",
"approved",
"refused"
]
}))
return app.save(collection)
})

View File

@@ -0,0 +1,29 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"passwordAuth": {
"identityFields": [
"username",
"email"
]
}
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"passwordAuth": {
"identityFields": [
"username"
]
}
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,20 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"viewRule": "id = @request.auth.id || @request.body.admin = true"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"viewRule": "id = @request.auth.id"
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,20 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"listRule": "id = @request.auth.id || @request.body.admin = true"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"listRule": "id = @request.auth.id"
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,22 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"listRule": "id = @request.auth.id || @request.auth.admin = true",
"manageRule": "@request.auth.admin = true"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"listRule": "id = @request.auth.id || @request.body.admin = true",
"manageRule": null
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,20 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"viewRule": "id = @request.auth.id || @request.auth.admin = true"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"viewRule": "id = @request.auth.id || @request.body.admin = true"
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,44 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"refused",
"pending"
]
}))
return app.save(collection)
})

View File

@@ -0,0 +1,67 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = new Collection({
"createRule": null,
"deleteRule": null,
"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"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Vsov",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
},
{
"hidden": false,
"id": "_clone_KD7P",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}
],
"id": "pbc_2668482079",
"indexes": [],
"listRule": null,
"name": "community_gallery",
"system": false,
"type": "view",
"updateRule": null,
"viewQuery": "SELECT id, name, status FROM submissions",
"viewRule": null
});
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079");
return app.delete(collection);
})

View File

@@ -0,0 +1,120 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT id, name, status, assets FROM submissions"
}, collection)
// remove field
collection.fields.removeById("_clone_Vsov")
// remove field
collection.fields.removeById("_clone_KD7P")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Qk1t",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_ki4I",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_PpoB",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT id, name, status FROM submissions"
}, collection)
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Vsov",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_KD7P",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// remove field
collection.fields.removeById("_clone_Qk1t")
// remove field
collection.fields.removeById("_clone_ki4I")
// remove field
collection.fields.removeById("_clone_PpoB")
return app.save(collection)
})

View File

@@ -0,0 +1,144 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"listRule": "",
"viewRule": ""
}, collection)
// remove field
collection.fields.removeById("_clone_Qk1t")
// remove field
collection.fields.removeById("_clone_ki4I")
// remove field
collection.fields.removeById("_clone_PpoB")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_60Zn",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_NQSW",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_CEqL",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"listRule": null,
"viewRule": null
}, collection)
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Qk1t",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_ki4I",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_PpoB",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// remove field
collection.fields.removeById("_clone_60Zn")
// remove field
collection.fields.removeById("_clone_NQSW")
// remove field
collection.fields.removeById("_clone_CEqL")
return app.save(collection)
})

View File

@@ -0,0 +1,179 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n s.created_by,\n u.username\nFROM submissions s\nJOIN users u ON s.created_by = u.id;"
}, collection)
// remove field
collection.fields.removeById("_clone_60Zn")
// remove field
collection.fields.removeById("_clone_NQSW")
// remove field
collection.fields.removeById("_clone_CEqL")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_PVgQ",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_Pydh",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_IDgw",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// add field
collection.fields.addAt(4, new Field({
"cascadeDelete": false,
"collectionId": "_pb_users_auth_",
"hidden": false,
"id": "_clone_PcJq",
"maxSelect": 1,
"minSelect": 0,
"name": "created_by",
"presentable": true,
"required": true,
"system": false,
"type": "relation"
}))
// add field
collection.fields.addAt(5, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Wpjd",
"max": 255,
"min": 5,
"name": "username",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT id, name, status, assets FROM submissions"
}, collection)
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_60Zn",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_NQSW",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_CEqL",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// remove field
collection.fields.removeById("_clone_PVgQ")
// remove field
collection.fields.removeById("_clone_Pydh")
// remove field
collection.fields.removeById("_clone_IDgw")
// remove field
collection.fields.removeById("_clone_PcJq")
// remove field
collection.fields.removeById("_clone_Wpjd")
return app.save(collection)
})

View File

@@ -0,0 +1,198 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n u.username AS created_by\nFROM submissions s\nJOIN users u ON s.created_by = u.id;"
}, collection)
// remove field
collection.fields.removeById("_clone_PVgQ")
// remove field
collection.fields.removeById("_clone_Pydh")
// remove field
collection.fields.removeById("_clone_IDgw")
// remove field
collection.fields.removeById("_clone_PcJq")
// remove field
collection.fields.removeById("_clone_Wpjd")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_qxS8",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_soay",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_ViRy",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// add field
collection.fields.addAt(4, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Td44",
"max": 255,
"min": 5,
"name": "created_by",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n s.created_by,\n u.username\nFROM submissions s\nJOIN users u ON s.created_by = u.id;"
}, collection)
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_PVgQ",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_Pydh",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_IDgw",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// add field
collection.fields.addAt(4, new Field({
"cascadeDelete": false,
"collectionId": "_pb_users_auth_",
"hidden": false,
"id": "_clone_PcJq",
"maxSelect": 1,
"minSelect": 0,
"name": "created_by",
"presentable": true,
"required": true,
"system": false,
"type": "relation"
}))
// add field
collection.fields.addAt(5, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Wpjd",
"max": 255,
"min": 5,
"name": "username",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// remove field
collection.fields.removeById("_clone_qxS8")
// remove field
collection.fields.removeById("_clone_soay")
// remove field
collection.fields.removeById("_clone_ViRy")
// remove field
collection.fields.removeById("_clone_Td44")
return app.save(collection)
})

View File

@@ -0,0 +1,45 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected",
"added_to_collection"
]
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_632646243")
// update field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "select2063623452",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected"
]
}))
return app.save(collection)
})

View File

@@ -0,0 +1,227 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n s.updated,\n s.created,\n s.extras,\n u.username AS created_by\nFROM submissions s\nJOIN users u ON s.created_by = u.id;"
}, collection)
// remove field
collection.fields.removeById("_clone_vRXF")
// remove field
collection.fields.removeById("_clone_I7rz")
// remove field
collection.fields.removeById("_clone_yLLt")
// remove field
collection.fields.removeById("_clone_NzXr")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_Jwk2",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_5hwn",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected",
"added_to_collection"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_EUTS",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// add field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "_clone_XtYJ",
"name": "updated",
"onCreate": true,
"onUpdate": true,
"presentable": false,
"system": false,
"type": "autodate"
}))
// add field
collection.fields.addAt(5, new Field({
"hidden": false,
"id": "_clone_cSF4",
"name": "created",
"onCreate": true,
"onUpdate": false,
"presentable": false,
"system": false,
"type": "autodate"
}))
// add field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "_clone_SoU0",
"maxSize": 0,
"name": "extras",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
// add field
collection.fields.addAt(7, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_OlCN",
"max": 255,
"min": 5,
"name": "created_by",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2668482079")
// update collection data
unmarshal({
"viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n u.username AS created_by\nFROM submissions s\nJOIN users u ON s.created_by = u.id;"
}, collection)
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_vRXF",
"max": 128,
"min": 0,
"name": "name",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "_clone_I7rz",
"maxSelect": 1,
"name": "status",
"presentable": true,
"required": true,
"system": false,
"type": "select",
"values": [
"approved",
"pending",
"rejected",
"added_to_collection"
]
}))
// add field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "_clone_yLLt",
"maxSelect": 99,
"maxSize": 0,
"mimeTypes": [
"image/png",
"image/svg+xml"
],
"name": "assets",
"presentable": false,
"protected": false,
"required": true,
"system": false,
"thumbs": [],
"type": "file"
}))
// add field
collection.fields.addAt(4, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_NzXr",
"max": 255,
"min": 5,
"name": "created_by",
"pattern": "",
"presentable": true,
"primaryKey": false,
"required": true,
"system": false,
"type": "text"
}))
// remove field
collection.fields.removeById("_clone_Jwk2")
// remove field
collection.fields.removeById("_clone_5hwn")
// remove field
collection.fields.removeById("_clone_EUTS")
// remove field
collection.fields.removeById("_clone_XtYJ")
// remove field
collection.fields.removeById("_clone_cSF4")
// remove field
collection.fields.removeById("_clone_SoU0")
// remove field
collection.fields.removeById("_clone_OlCN")
return app.save(collection)
})

View File

@@ -0,0 +1,22 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"createRule": "",
"manageRule": null
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"createRule": "@request.body.admin = false || @request.body.admin = null",
"manageRule": "@request.auth.admin = true"
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,20 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"createRule": "@request.body.admin = false || @request.body.admin = null"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"createRule": ""
}, collection)
return app.save(collection)
})