mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-24 06:25:48 +00:00
fix(mothership): add error handling for domain collection deletion
This commit is contained in:
parent
722d2f523c
commit
a91b3a81ef
@ -1,73 +1,80 @@
|
|||||||
/// <reference path="../pb_data/types.d.ts" />
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
migrate((db) => {
|
migrate(
|
||||||
const dao = new Dao(db);
|
(db) => {
|
||||||
const collection = dao.findCollectionByNameOrId("jw1wz9nmkvnhcm6");
|
const dao = new Dao(db)
|
||||||
|
try {
|
||||||
|
const collection = dao.findCollectionByNameOrId('jw1wz9nmkvnhcm6')
|
||||||
|
|
||||||
return dao.deleteCollection(collection);
|
return dao.deleteCollection(collection)
|
||||||
}, (db) => {
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(db) => {
|
||||||
const collection = new Collection({
|
const collection = new Collection({
|
||||||
"id": "jw1wz9nmkvnhcm6",
|
id: 'jw1wz9nmkvnhcm6',
|
||||||
"created": "2025-07-18 05:18:37.698Z",
|
created: '2025-07-18 05:18:37.698Z',
|
||||||
"updated": "2025-07-19 01:09:48.781Z",
|
updated: '2025-07-19 01:09:48.781Z',
|
||||||
"name": "domains",
|
name: 'domains',
|
||||||
"type": "base",
|
type: 'base',
|
||||||
"system": false,
|
system: false,
|
||||||
"schema": [
|
schema: [
|
||||||
{
|
{
|
||||||
"system": false,
|
system: false,
|
||||||
"id": "fhie5snn",
|
id: 'fhie5snn',
|
||||||
"name": "instance",
|
name: 'instance',
|
||||||
"type": "relation",
|
type: 'relation',
|
||||||
"required": false,
|
required: false,
|
||||||
"presentable": false,
|
presentable: false,
|
||||||
"unique": false,
|
unique: false,
|
||||||
"options": {
|
options: {
|
||||||
"collectionId": "etae8tuiaxl6xfv",
|
collectionId: 'etae8tuiaxl6xfv',
|
||||||
"cascadeDelete": false,
|
cascadeDelete: false,
|
||||||
"minSelect": null,
|
minSelect: null,
|
||||||
"maxSelect": 1,
|
maxSelect: 1,
|
||||||
"displayFields": null
|
displayFields: null,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"system": false,
|
system: false,
|
||||||
"id": "wn3oncif",
|
id: 'wn3oncif',
|
||||||
"name": "domain",
|
name: 'domain',
|
||||||
"type": "text",
|
type: 'text',
|
||||||
"required": false,
|
required: false,
|
||||||
"presentable": true,
|
presentable: true,
|
||||||
"unique": false,
|
unique: false,
|
||||||
"options": {
|
options: {
|
||||||
"min": null,
|
min: null,
|
||||||
"max": null,
|
max: null,
|
||||||
"pattern": ""
|
pattern: '',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"system": false,
|
system: false,
|
||||||
"id": "vzkcvhhg",
|
id: 'vzkcvhhg',
|
||||||
"name": "active",
|
name: 'active',
|
||||||
"type": "bool",
|
type: 'bool',
|
||||||
"required": false,
|
required: false,
|
||||||
"presentable": false,
|
presentable: false,
|
||||||
"unique": false,
|
unique: false,
|
||||||
"options": {}
|
options: {},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"indexes": [
|
indexes: [
|
||||||
"CREATE UNIQUE INDEX `idx_gtGcwf2` ON `domains` (`domain`)",
|
'CREATE UNIQUE INDEX `idx_gtGcwf2` ON `domains` (`domain`)',
|
||||||
"CREATE INDEX `idx_OtPOwXe` ON `domains` (`instance`)",
|
'CREATE INDEX `idx_OtPOwXe` ON `domains` (`instance`)',
|
||||||
"CREATE INDEX `idx_0omsTdi` ON `domains` (`created`)",
|
'CREATE INDEX `idx_0omsTdi` ON `domains` (`created`)',
|
||||||
"CREATE INDEX `idx_uMaIOVQ` ON `domains` (`updated`)",
|
'CREATE INDEX `idx_uMaIOVQ` ON `domains` (`updated`)',
|
||||||
"CREATE UNIQUE INDEX `idx_VLBOSap` ON `domains` (\n `instance`,\n `domain`\n)"
|
'CREATE UNIQUE INDEX `idx_VLBOSap` ON `domains` (\n `instance`,\n `domain`\n)',
|
||||||
],
|
],
|
||||||
"listRule": "@request.auth.id=instance.uid",
|
listRule: '@request.auth.id=instance.uid',
|
||||||
"viewRule": "@request.auth.id=instance.uid",
|
viewRule: '@request.auth.id=instance.uid',
|
||||||
"createRule": null,
|
createRule: null,
|
||||||
"updateRule": null,
|
updateRule: null,
|
||||||
"deleteRule": null,
|
deleteRule: null,
|
||||||
"options": {}
|
options: {},
|
||||||
});
|
|
||||||
|
|
||||||
return Dao(db).saveCollection(collection);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return Dao(db).saveCollection(collection)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user