From 0d330c4f60fadeb7de027a59f144d21e544b6ba1 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Fri, 8 Dec 2023 21:34:16 +0100 Subject: [PATCH] Add pocketbase migrations --- .gitignore | 3 + pb_migrations/1702060859_created_tasks.js | 82 +++++++++++++++++++ pb_migrations/1702060887_created_tasklists.js | 41 ++++++++++ pb_migrations/1702060926_updated_tasks.js | 48 +++++++++++ pb_migrations/1702060974_updated_tasks.js | 33 ++++++++ pb_migrations/1702061080_updated_tasks.js | 48 +++++++++++ pb_migrations/1702061316_updated_tasklists.js | 33 ++++++++ pb_migrations/1702061327_updated_tasks.js | 48 +++++++++++ pb_migrations/1702061579_updated_tasks.js | 44 ++++++++++ pb_migrations/1702061613_updated_tasks.js | 44 ++++++++++ .../1702062145_created_completions.js | 59 +++++++++++++ pb_migrations/1702062154_updated_tasklists.js | 16 ++++ pb_migrations/1702062168_updated_lists.js | 48 +++++++++++ 13 files changed, 547 insertions(+) create mode 100644 .gitignore create mode 100644 pb_migrations/1702060859_created_tasks.js create mode 100644 pb_migrations/1702060887_created_tasklists.js create mode 100644 pb_migrations/1702060926_updated_tasks.js create mode 100644 pb_migrations/1702060974_updated_tasks.js create mode 100644 pb_migrations/1702061080_updated_tasks.js create mode 100644 pb_migrations/1702061316_updated_tasklists.js create mode 100644 pb_migrations/1702061327_updated_tasks.js create mode 100644 pb_migrations/1702061579_updated_tasks.js create mode 100644 pb_migrations/1702061613_updated_tasks.js create mode 100644 pb_migrations/1702062145_created_completions.js create mode 100644 pb_migrations/1702062154_updated_tasklists.js create mode 100644 pb_migrations/1702062168_updated_lists.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..376f0c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/pocketbase +/pb_data/ + diff --git a/pb_migrations/1702060859_created_tasks.js b/pb_migrations/1702060859_created_tasks.js new file mode 100644 index 0000000..96b57e6 --- /dev/null +++ b/pb_migrations/1702060859_created_tasks.js @@ -0,0 +1,82 @@ +/// +migrate((db) => { + const collection = new Collection({ + "id": "pf13z4hs1iubw41", + "created": "2023-12-08 18:40:59.946Z", + "updated": "2023-12-08 18:40:59.946Z", + "name": "tasks", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "hthpvzja", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "hrzb5spy", + "name": "description", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "qjz9b0tm", + "name": "schedule", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "", + "max": "" + } + }, + { + "system": false, + "id": "ryukqaol", + "name": "repeatInterval", + "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": {} + }); + + return Dao(db).saveCollection(collection); +}, (db) => { + const dao = new Dao(db); + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41"); + + return dao.deleteCollection(collection); +}) diff --git a/pb_migrations/1702060887_created_tasklists.js b/pb_migrations/1702060887_created_tasklists.js new file mode 100644 index 0000000..f3f9ceb --- /dev/null +++ b/pb_migrations/1702060887_created_tasklists.js @@ -0,0 +1,41 @@ +/// +migrate((db) => { + const collection = new Collection({ + "id": "i42xt9r6ykqdq3j", + "created": "2023-12-08 18:41:27.908Z", + "updated": "2023-12-08 18:41:27.908Z", + "name": "tasklists", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "gjhxaxm4", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }); + + return Dao(db).saveCollection(collection); +}, (db) => { + const dao = new Dao(db); + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j"); + + return dao.deleteCollection(collection); +}) diff --git a/pb_migrations/1702060926_updated_tasks.js b/pb_migrations/1702060926_updated_tasks.js new file mode 100644 index 0000000..afa4ce3 --- /dev/null +++ b/pb_migrations/1702060926_updated_tasks.js @@ -0,0 +1,48 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // remove + collection.schema.removeField("hrzb5spy") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "bkjgp8xt", + "name": "description", + "type": "editor", + "required": false, + "presentable": false, + "unique": false, + "options": { + "convertUrls": false + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "hrzb5spy", + "name": "description", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + })) + + // remove + collection.schema.removeField("bkjgp8xt") + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702060974_updated_tasks.js b/pb_migrations/1702060974_updated_tasks.js new file mode 100644 index 0000000..fda9c91 --- /dev/null +++ b/pb_migrations/1702060974_updated_tasks.js @@ -0,0 +1,33 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6gfllcfj", + "name": "list", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // remove + collection.schema.removeField("6gfllcfj") + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702061080_updated_tasks.js b/pb_migrations/1702061080_updated_tasks.js new file mode 100644 index 0000000..c7716d5 --- /dev/null +++ b/pb_migrations/1702061080_updated_tasks.js @@ -0,0 +1,48 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6gfllcfj", + "name": "list", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6gfllcfj", + "name": "list", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702061316_updated_tasklists.js b/pb_migrations/1702061316_updated_tasklists.js new file mode 100644 index 0000000..6e90ace --- /dev/null +++ b/pb_migrations/1702061316_updated_tasklists.js @@ -0,0 +1,33 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j") + + // add + collection.schema.addField(new SchemaField({ + "system": false, + "id": "vm4xdjfy", + "name": "parentList", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j") + + // remove + collection.schema.removeField("vm4xdjfy") + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702061327_updated_tasks.js b/pb_migrations/1702061327_updated_tasks.js new file mode 100644 index 0000000..cae249c --- /dev/null +++ b/pb_migrations/1702061327_updated_tasks.js @@ -0,0 +1,48 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6gfllcfj", + "name": "list", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "6gfllcfj", + "name": "list", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702061579_updated_tasks.js b/pb_migrations/1702061579_updated_tasks.js new file mode 100644 index 0000000..1bf4ac4 --- /dev/null +++ b/pb_migrations/1702061579_updated_tasks.js @@ -0,0 +1,44 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ryukqaol", + "name": "cooldown", + "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("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ryukqaol", + "name": "repeatInterval", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + })) + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702061613_updated_tasks.js b/pb_migrations/1702061613_updated_tasks.js new file mode 100644 index 0000000..717992c --- /dev/null +++ b/pb_migrations/1702061613_updated_tasks.js @@ -0,0 +1,44 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ryukqaol", + "name": "cooldown", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": 1, + "max": null, + "noDecimal": true + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("pf13z4hs1iubw41") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "ryukqaol", + "name": "cooldown", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": false + } + })) + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702062145_created_completions.js b/pb_migrations/1702062145_created_completions.js new file mode 100644 index 0000000..9f73e85 --- /dev/null +++ b/pb_migrations/1702062145_created_completions.js @@ -0,0 +1,59 @@ +/// +migrate((db) => { + const collection = new Collection({ + "id": "jebj4y3fqo5gtte", + "created": "2023-12-08 19:02:25.763Z", + "updated": "2023-12-08 19:02:25.763Z", + "name": "completions", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "dcsjlzex", + "name": "task", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "pf13z4hs1iubw41", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "ewnc7huz", + "name": "user", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + } + ], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }); + + return Dao(db).saveCollection(collection); +}, (db) => { + const dao = new Dao(db); + const collection = dao.findCollectionByNameOrId("jebj4y3fqo5gtte"); + + return dao.deleteCollection(collection); +}) diff --git a/pb_migrations/1702062154_updated_tasklists.js b/pb_migrations/1702062154_updated_tasklists.js new file mode 100644 index 0000000..4952924 --- /dev/null +++ b/pb_migrations/1702062154_updated_tasklists.js @@ -0,0 +1,16 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j") + + collection.name = "lists" + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j") + + collection.name = "tasklists" + + return dao.saveCollection(collection) +}) diff --git a/pb_migrations/1702062168_updated_lists.js b/pb_migrations/1702062168_updated_lists.js new file mode 100644 index 0000000..daacdfc --- /dev/null +++ b/pb_migrations/1702062168_updated_lists.js @@ -0,0 +1,48 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "vm4xdjfy", + "name": "parent", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("i42xt9r6ykqdq3j") + + // update + collection.schema.addField(new SchemaField({ + "system": false, + "id": "vm4xdjfy", + "name": "parentList", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "i42xt9r6ykqdq3j", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + })) + + return dao.saveCollection(collection) +})