mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-04 03:42:29 +00:00
add cname_active flag
This commit is contained in:
parent
c0a2e1b7ab
commit
fbbaea4a29
@ -0,0 +1,47 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv")
|
||||||
|
|
||||||
|
collection.indexes = [
|
||||||
|
"CREATE UNIQUE INDEX `idx_unique_qdtuuld1` ON `instances` (`subdomain`)",
|
||||||
|
"CREATE INDEX `idx_DKUSkMx` ON `instances` (`status`)",
|
||||||
|
"CREATE INDEX `idx_fhfKrpl` ON `instances` (`uid`)",
|
||||||
|
"CREATE INDEX `idx_TfdgNnO` ON `instances` (`maintenance`)",
|
||||||
|
"CREATE INDEX `idx_FrmHehp` ON `instances` (`created`)",
|
||||||
|
"CREATE INDEX `idx_tNMeylJ` ON `instances` (`updated`)",
|
||||||
|
"CREATE UNIQUE INDEX `idx_rBYwAXi` ON `instances` (`cname_active`) WHERE cname != ''"
|
||||||
|
]
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "hsoandop",
|
||||||
|
"name": "cname_active",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv")
|
||||||
|
|
||||||
|
collection.indexes = [
|
||||||
|
"CREATE UNIQUE INDEX `idx_unique_qdtuuld1` ON `instances` (`subdomain`)",
|
||||||
|
"CREATE INDEX `idx_DKUSkMx` ON `instances` (`status`)",
|
||||||
|
"CREATE INDEX `idx_fhfKrpl` ON `instances` (`uid`)",
|
||||||
|
"CREATE INDEX `idx_TfdgNnO` ON `instances` (`maintenance`)",
|
||||||
|
"CREATE INDEX `idx_FrmHehp` ON `instances` (`created`)",
|
||||||
|
"CREATE INDEX `idx_tNMeylJ` ON `instances` (`updated`)",
|
||||||
|
"CREATE UNIQUE INDEX `idx_rBYwAXi` ON `instances` (`cname`) WHERE cname != ''"
|
||||||
|
]
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("hsoandop")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -36,7 +36,9 @@ export const createInstanceMixin = (context: MixinContext) => {
|
|||||||
): Promise<InstanceFields & WithUser> =>
|
): Promise<InstanceFields & WithUser> =>
|
||||||
client
|
client
|
||||||
.collection(INSTANCE_COLLECTION)
|
.collection(INSTANCE_COLLECTION)
|
||||||
.getFirstListItem(`cname = '${host}'`, { expand: 'uid' })
|
.getFirstListItem(`cname = '${host}' and cname_active = 1`, {
|
||||||
|
expand: 'uid',
|
||||||
|
})
|
||||||
|
|
||||||
const getInstanceById = async (
|
const getInstanceById = async (
|
||||||
instanceId: InstanceId,
|
instanceId: InstanceId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user