From 3c9da5bcaea749a75f477a3494e6f4fca77eb85c Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sun, 24 Dec 2023 22:13:39 +0000 Subject: [PATCH] Add stripe payments --- .../1703438474_created_stripe_payments.js | 61 +++++++++++++++++++ .../1703439505_updated_stripe_payments.js | 25 ++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/mothership-app/migrations/1703438474_created_stripe_payments.js create mode 100644 src/mothership-app/migrations/1703439505_updated_stripe_payments.js diff --git a/src/mothership-app/migrations/1703438474_created_stripe_payments.js b/src/mothership-app/migrations/1703438474_created_stripe_payments.js new file mode 100644 index 00000000..d6fd4156 --- /dev/null +++ b/src/mothership-app/migrations/1703438474_created_stripe_payments.js @@ -0,0 +1,61 @@ +/// +migrate((db) => { + const collection = new Collection({ + "id": "iff2jfzb89dwiov", + "created": "2023-12-24 17:21:14.169Z", + "updated": "2023-12-24 17:21:14.169Z", + "name": "stripe_payments", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "uhurtdtl", + "name": "user", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "systemprofiles0", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "tgaer8rx", + "name": "stripe_payment_id", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ], + "indexes": [ + "CREATE INDEX `idx_DezkBvw` ON `stripe_payments` (`user`)", + "CREATE INDEX `idx_A5j325f` ON `stripe_payments` (`stripe_payment_id`)", + "CREATE INDEX `idx_qBPC3VW` ON `stripe_payments` (`created`)" + ], + "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("iff2jfzb89dwiov"); + + return dao.deleteCollection(collection); +}) diff --git a/src/mothership-app/migrations/1703439505_updated_stripe_payments.js b/src/mothership-app/migrations/1703439505_updated_stripe_payments.js new file mode 100644 index 00000000..fc54ebec --- /dev/null +++ b/src/mothership-app/migrations/1703439505_updated_stripe_payments.js @@ -0,0 +1,25 @@ +/// +migrate((db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("iff2jfzb89dwiov") + + collection.indexes = [ + "CREATE INDEX `idx_DezkBvw` ON `stripe_payments` (`user`)", + "CREATE INDEX `idx_A5j325f` ON `stripe_payments` (`stripe_payment_id`)", + "CREATE INDEX `idx_qBPC3VW` ON `stripe_payments` (`created`)", + "CREATE UNIQUE INDEX `idx_NPkwSnu` ON `stripe_payments` (`stripe_payment_id`)" + ] + + return dao.saveCollection(collection) +}, (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId("iff2jfzb89dwiov") + + collection.indexes = [ + "CREATE INDEX `idx_DezkBvw` ON `stripe_payments` (`user`)", + "CREATE INDEX `idx_A5j325f` ON `stripe_payments` (`stripe_payment_id`)", + "CREATE INDEX `idx_qBPC3VW` ON `stripe_payments` (`created`)" + ] + + return dao.saveCollection(collection) +})