mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
Refactor stripe payments table
This commit is contained in:
parent
b6c8a6ca18
commit
92ddadd86b
@ -0,0 +1,60 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("iff2jfzb89dwiov")
|
||||||
|
|
||||||
|
collection.name = "payments"
|
||||||
|
collection.indexes = [
|
||||||
|
"CREATE INDEX `idx_DezkBvw` ON `payments` (`user`)",
|
||||||
|
"CREATE INDEX `idx_A5j325f` ON `payments` (`payment_id`)",
|
||||||
|
"CREATE INDEX `idx_qBPC3VW` ON `payments` (`created`)",
|
||||||
|
"CREATE UNIQUE INDEX `idx_NPkwSnu` ON `payments` (`payment_id`)"
|
||||||
|
]
|
||||||
|
|
||||||
|
// update
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "tgaer8rx",
|
||||||
|
"name": "payment_id",
|
||||||
|
"type": "text",
|
||||||
|
"required": true,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"pattern": ""
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("iff2jfzb89dwiov")
|
||||||
|
|
||||||
|
collection.name = "stripe_payments"
|
||||||
|
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`)"
|
||||||
|
]
|
||||||
|
|
||||||
|
// update
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "tgaer8rx",
|
||||||
|
"name": "stripe_payment_id",
|
||||||
|
"type": "text",
|
||||||
|
"required": true,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"pattern": ""
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user