pockethost/packages/daemon/migrations/1694789066_updated_potentialPaidUsersView.js
2023-10-02 11:38:15 -07:00

66 lines
1.5 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate(
(db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj')
collection.options = {
query:
'select id,email from users where id in (select uid from instances where secondsThisMonth<=6000)',
}
// remove
collection.schema.removeField('2gw1y72t')
// add
collection.schema.addField(
new SchemaField({
system: false,
id: 'mu8wxouc',
name: 'email',
type: 'email',
required: false,
presentable: false,
unique: false,
options: {
exceptDomains: null,
onlyDomains: null,
},
}),
)
return dao.saveCollection(collection)
},
(db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj')
collection.options = {
query:
'select id,email from users where id in (select uid from instances where secondsThisMonth>6000)',
}
// add
collection.schema.addField(
new SchemaField({
system: false,
id: '2gw1y72t',
name: 'email',
type: 'email',
required: false,
presentable: false,
unique: false,
options: {
exceptDomains: null,
onlyDomains: null,
},
}),
)
// remove
collection.schema.removeField('mu8wxouc')
return dao.saveCollection(collection)
},
)