mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
fix: db migrations
This commit is contained in:
parent
ffea08d47d
commit
a4652cc124
@ -0,0 +1,56 @@
|
|||||||
|
/// <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("mu8wxouc")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "4dwqriso",
|
||||||
|
"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": "mu8wxouc",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("4dwqriso")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -0,0 +1,71 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth>6000"
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("4dwqriso")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "jeo2co2y",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "pcl2olai",
|
||||||
|
"name": "secondsThisMonth",
|
||||||
|
"type": "json",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
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": "4dwqriso",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("jeo2co2y")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("pcl2olai")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -0,0 +1,86 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>500"
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("jeo2co2y")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("pcl2olai")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "4nas99bt",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "pmfykpks",
|
||||||
|
"name": "secondsThisMonth",
|
||||||
|
"type": "json",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth>6000"
|
||||||
|
}
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "jeo2co2y",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "pcl2olai",
|
||||||
|
"name": "secondsThisMonth",
|
||||||
|
"type": "json",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("4nas99bt")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("pmfykpks")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -0,0 +1,86 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("4nas99bt")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("pmfykpks")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "c0fjqkvh",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "nrzmfvrb",
|
||||||
|
"name": "secondsThisMonth",
|
||||||
|
"type": "json",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>500"
|
||||||
|
}
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "4nas99bt",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "pmfykpks",
|
||||||
|
"name": "secondsThisMonth",
|
||||||
|
"type": "json",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("c0fjqkvh")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("nrzmfvrb")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
31
packages/daemon/migrations/1695250305_updated_users.js
Normal file
31
packages/daemon/migrations/1695250305_updated_users.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("rgwv4xhk")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "rgwv4xhk",
|
||||||
|
"name": "totalSecondsThisMonth",
|
||||||
|
"type": "number",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"noDecimal": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -0,0 +1,90 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "SELECT u.id,\n email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND secondsthismonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("c0fjqkvh")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("nrzmfvrb")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "9xsegduz",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "4dmlmvan",
|
||||||
|
"name": "secondsthismonth",
|
||||||
|
"type": "number",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"noDecimal": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "c0fjqkvh",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "nrzmfvrb",
|
||||||
|
"name": "secondsThisMonth",
|
||||||
|
"type": "json",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("9xsegduz")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("4dmlmvan")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -0,0 +1,94 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "SELECT u.id,\n u.email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND i.secondsthismonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("9xsegduz")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("4dmlmvan")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "omarcdxd",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "c2czszfp",
|
||||||
|
"name": "secondsthismonth",
|
||||||
|
"type": "number",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"noDecimal": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "SELECT u.id,\n email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND secondsthismonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "9xsegduz",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "4dmlmvan",
|
||||||
|
"name": "secondsthismonth",
|
||||||
|
"type": "number",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"noDecimal": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("omarcdxd")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("c2czszfp")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
@ -4,13 +4,13 @@ migrate((db) => {
|
|||||||
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
collection.indexes = [
|
collection.indexes = [
|
||||||
"CREATE INDEX `idx_5qCe15w` ON `users` (`secondsThisMonth`)"
|
"CREATE INDEX `idx_q4Kji47` ON `users` (`secondsThisMonth`)"
|
||||||
]
|
]
|
||||||
|
|
||||||
// add
|
// add
|
||||||
collection.schema.addField(new SchemaField({
|
collection.schema.addField(new SchemaField({
|
||||||
"system": false,
|
"system": false,
|
||||||
"id": "4xchr8ic",
|
"id": "qz4cjamg",
|
||||||
"name": "secondsThisMonth",
|
"name": "secondsThisMonth",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": false,
|
"required": false,
|
||||||
@ -31,7 +31,7 @@ migrate((db) => {
|
|||||||
collection.indexes = []
|
collection.indexes = []
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
collection.schema.removeField("4xchr8ic")
|
collection.schema.removeField("qz4cjamg")
|
||||||
|
|
||||||
return dao.saveCollection(collection)
|
return dao.saveCollection(collection)
|
||||||
})
|
})
|
@ -0,0 +1,94 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.secondsthismonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("omarcdxd")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("c2czszfp")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "ld24cbna",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "g3qvj4tl",
|
||||||
|
"name": "secondsthismonth",
|
||||||
|
"type": "number",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"noDecimal": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj")
|
||||||
|
|
||||||
|
collection.options = {
|
||||||
|
"query": "SELECT u.id,\n u.email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND i.secondsthismonth/60>200"
|
||||||
|
}
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "omarcdxd",
|
||||||
|
"name": "email",
|
||||||
|
"type": "email",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"exceptDomains": null,
|
||||||
|
"onlyDomains": null
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "c2czszfp",
|
||||||
|
"name": "secondsthismonth",
|
||||||
|
"type": "number",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"noDecimal": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("ld24cbna")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("g3qvj4tl")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user