diff --git a/src/mothership-app/migrations/1702571433_created_user_growth_by_month.js b/src/mothership-app/migrations/1702571433_created_user_growth_by_month.js new file mode 100644 index 00000000..3fc1d352 --- /dev/null +++ b/src/mothership-app/migrations/1702571433_created_user_growth_by_month.js @@ -0,0 +1,55 @@ +/// +migrate((db) => { + const collection = new Collection({ + "id": "7vzz1jr2us7mwmx", + "created": "2023-12-14 16:30:33.330Z", + "updated": "2023-12-14 16:30:33.330Z", + "name": "user_growth_by_month", + "type": "view", + "system": false, + "schema": [ + { + "system": false, + "id": "r2f9pxks", + "name": "created_month", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + }, + { + "system": false, + "id": "hfwcgpmi", + "name": "number_of_users", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + } + ], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS created_month, \n COUNT(*) AS number_of_users \nFROM \n users \nGROUP BY \n created_month\n\torder by created_month asc\n" + } + }); + + return Dao(db).saveCollection(collection); +}, (db) => { + const dao = new Dao(db); + const collection = dao.findCollectionByNameOrId("7vzz1jr2us7mwmx"); + + return dao.deleteCollection(collection); +}) diff --git a/src/mothership-app/migrations/1702571505_updated_user_growth_by_month.js b/src/mothership-app/migrations/1702571505_updated_user_growth_by_month.js new file mode 100644 index 00000000..4fb9e1a9 --- /dev/null +++ b/src/mothership-app/migrations/1702571505_updated_user_growth_by_month.js @@ -0,0 +1,75 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS created, \n COUNT(*) AS total \nFROM \n users \nGROUP BY \n created\n\torder by created asc\n" + } + + // remove + collection.schema.removeField("r2f9pxks") + + // remove + collection.schema.removeField("hfwcgpmi") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "q1td6nqz", + "name": "total", + "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("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS created_month, \n COUNT(*) AS number_of_users \nFROM \n users \nGROUP BY \n created_month\n\torder by created_month asc\n" + } + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "r2f9pxks", + "name": "created_month", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + })) + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "hfwcgpmi", + "name": "number_of_users", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + })) + + // remove + collection.schema.removeField("q1td6nqz") + + return dao.saveCollection(collection) +}) diff --git a/src/mothership-app/migrations/1702571540_updated_user_growth_by_month.js b/src/mothership-app/migrations/1702571540_updated_user_growth_by_month.js new file mode 100644 index 00000000..d1aa2569 --- /dev/null +++ b/src/mothership-app/migrations/1702571540_updated_user_growth_by_month.js @@ -0,0 +1,75 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS t, \n COUNT(*) AS c \nFROM \n users \nGROUP BY \n t\n\torder by t asc\n" + } + + // remove + collection.schema.removeField("q1td6nqz") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6w2uyzd9", + "name": "t", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + })) + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ytpf0f1l", + "name": "c", + "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("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS created, \n COUNT(*) AS total \nFROM \n users \nGROUP BY \n created\n\torder by created asc\n" + } + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "q1td6nqz", + "name": "total", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + })) + + // remove + collection.schema.removeField("6w2uyzd9") + + // remove + collection.schema.removeField("ytpf0f1l") + + return dao.saveCollection(collection) +}) diff --git a/src/mothership-app/migrations/1702647048_updated_user_growth_by_month.js b/src/mothership-app/migrations/1702647048_updated_user_growth_by_month.js new file mode 100644 index 00000000..96fb0ca4 --- /dev/null +++ b/src/mothership-app/migrations/1702647048_updated_user_growth_by_month.js @@ -0,0 +1,92 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS t, \n COUNT(*) AS c \nFROM \n users \nGROUP BY \n t\n\torder by t desc\n" + } + + // remove + collection.schema.removeField("6w2uyzd9") + + // remove + collection.schema.removeField("ytpf0f1l") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ee4obryu", + "name": "t", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + })) + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "kq8xt1mi", + "name": "c", + "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("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS t, \n COUNT(*) AS c \nFROM \n users \nGROUP BY \n t\n\torder by t asc\n" + } + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6w2uyzd9", + "name": "t", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + })) + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ytpf0f1l", + "name": "c", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + })) + + // remove + collection.schema.removeField("ee4obryu") + + // remove + collection.schema.removeField("kq8xt1mi") + + return dao.saveCollection(collection) +}) diff --git a/src/mothership-app/migrations/1702647067_updated_user_growth_by_month.js b/src/mothership-app/migrations/1702647067_updated_user_growth_by_month.js new file mode 100644 index 00000000..3ace367c --- /dev/null +++ b/src/mothership-app/migrations/1702647067_updated_user_growth_by_month.js @@ -0,0 +1,92 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS t, \n COUNT(*) AS c \nFROM \n verified_users as users\nGROUP BY \n t\n\torder by t desc\n" + } + + // remove + collection.schema.removeField("ee4obryu") + + // remove + collection.schema.removeField("kq8xt1mi") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "pk5at00z", + "name": "t", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + })) + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "3ybi74j4", + "name": "c", + "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("7vzz1jr2us7mwmx") + + collection.options = { + "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS t, \n COUNT(*) AS c \nFROM \n users \nGROUP BY \n t\n\torder by t desc\n" + } + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ee4obryu", + "name": "t", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 1 + } + })) + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "kq8xt1mi", + "name": "c", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + })) + + // remove + collection.schema.removeField("pk5at00z") + + // remove + collection.schema.removeField("3ybi74j4") + + return dao.saveCollection(collection) +})