ceafc873c7
- Change game cover field from URL text to file upload (PocketBase migration) - AddGameDialog now supports drag-and-drop image upload instead of URL input - Add getGameCoverUrl() helper using pb.files.getUrl() for cover display - Fix games listRule/viewRule: group.members.id syntax doesn't work in PB 0.22, changed to group.members ~ @request.auth.id for correct member visibility - Update changelog with all v0.3.5 entries Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
/// <reference path="../pb_data/types.d.ts" />
|
|
migrate((db) => {
|
|
const dao = new Dao(db)
|
|
const collection = dao.findCollectionByNameOrId("x5adjlc0txf16r8")
|
|
|
|
// remove old url cover field
|
|
collection.schema.removeField("cover_field")
|
|
|
|
// add new file cover field
|
|
collection.schema.addField(new SchemaField({
|
|
"system": false,
|
|
"id": "cover_file",
|
|
"name": "cover",
|
|
"type": "file",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"maxSelect": 1,
|
|
"maxSize": 5242880,
|
|
"mimeTypes": ["image/jpeg","image/png","image/gif","image/webp","image/svg+xml"],
|
|
"thumbs": null,
|
|
"protected": false
|
|
}
|
|
}))
|
|
|
|
return dao.saveCollection(collection)
|
|
}, (db) => {
|
|
const dao = new Dao(db)
|
|
const collection = dao.findCollectionByNameOrId("x5adjlc0txf16r8")
|
|
|
|
// remove file cover field
|
|
collection.schema.removeField("cover_file")
|
|
|
|
// restore url cover field
|
|
collection.schema.addField(new SchemaField({
|
|
"system": false,
|
|
"id": "cover_field",
|
|
"name": "cover",
|
|
"type": "url",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"exceptDomains": null,
|
|
"onlyDomains": null
|
|
}
|
|
}))
|
|
|
|
return dao.saveCollection(collection)
|
|
})
|