diff --git a/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..e175758d
--- /dev/null
+++ b/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js
@@ -0,0 +1,56 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..732f9fb5
--- /dev/null
+++ b/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js
@@ -0,0 +1,71 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..1ef65c35
--- /dev/null
+++ b/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js
@@ -0,0 +1,86 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..ec5a1e78
--- /dev/null
+++ b/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js
@@ -0,0 +1,86 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1695250305_updated_users.js b/packages/daemon/migrations/1695250305_updated_users.js
new file mode 100644
index 00000000..2093c763
--- /dev/null
+++ b/packages/daemon/migrations/1695250305_updated_users.js
@@ -0,0 +1,31 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..1b6ff74a
--- /dev/null
+++ b/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js
@@ -0,0 +1,90 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..ce8c170d
--- /dev/null
+++ b/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js
@@ -0,0 +1,94 @@
+///
+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)
+})
diff --git a/packages/daemon/migrations/1695235877_updated_users.js b/packages/daemon/migrations/1695250393_updated_users.js
similarity index 84%
rename from packages/daemon/migrations/1695235877_updated_users.js
rename to packages/daemon/migrations/1695250393_updated_users.js
index 35642136..13000544 100644
--- a/packages/daemon/migrations/1695235877_updated_users.js
+++ b/packages/daemon/migrations/1695250393_updated_users.js
@@ -4,13 +4,13 @@ migrate((db) => {
const collection = dao.findCollectionByNameOrId("systemprofiles0")
collection.indexes = [
- "CREATE INDEX `idx_5qCe15w` ON `users` (`secondsThisMonth`)"
+ "CREATE INDEX `idx_q4Kji47` ON `users` (`secondsThisMonth`)"
]
// add
collection.schema.addField(new SchemaField({
"system": false,
- "id": "4xchr8ic",
+ "id": "qz4cjamg",
"name": "secondsThisMonth",
"type": "number",
"required": false,
@@ -31,7 +31,7 @@ migrate((db) => {
collection.indexes = []
// remove
- collection.schema.removeField("4xchr8ic")
+ collection.schema.removeField("qz4cjamg")
return dao.saveCollection(collection)
})
diff --git a/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js
new file mode 100644
index 00000000..22756be8
--- /dev/null
+++ b/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js
@@ -0,0 +1,94 @@
+///
+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)
+})