enh: add unpaid user subcription type

This commit is contained in:
Ben Allfree 2025-01-09 19:54:42 +00:00
parent 673f897723
commit 85c10f66e2
3 changed files with 545 additions and 0 deletions

View File

@ -0,0 +1,179 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("s00x84jumfjcuvc")
// remove
collection.schema.removeField("kij3qt2u")
// remove
collection.schema.removeField("cwdyzhim")
// remove
collection.schema.removeField("ou52evzg")
// remove
collection.schema.removeField("shuxbcrz")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "h4ghvr0j",
"name": "username",
"type": "text",
"required": false,
"presentable": false,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "xsw6d7vd",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "fpeo0wzq",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"unpaid",
"premium",
"founder",
"flounder",
"legacy"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "rloy8p0i",
"name": "subscription_interval",
"type": "select",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"month",
"year",
"life"
]
}
}))
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("s00x84jumfjcuvc")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "kij3qt2u",
"name": "username",
"type": "text",
"required": false,
"presentable": false,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "cwdyzhim",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "ou52evzg",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"premium",
"founder",
"flounder",
"legacy"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "shuxbcrz",
"name": "subscription_interval",
"type": "select",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"month",
"year",
"life"
]
}
}))
// remove
collection.schema.removeField("h4ghvr0j")
// remove
collection.schema.removeField("xsw6d7vd")
// remove
collection.schema.removeField("fpeo0wzq")
// remove
collection.schema.removeField("rloy8p0i")
return dao.saveCollection(collection)
})

View File

@ -0,0 +1,55 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("systemprofiles0")
// update
collection.schema.addField(new SchemaField({
"system": false,
"id": "7jf2i4be",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"unpaid",
"premium",
"founder",
"flounder",
"legacy"
]
}
}))
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("systemprofiles0")
// update
collection.schema.addField(new SchemaField({
"system": false,
"id": "7jf2i4be",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"premium",
"founder",
"flounder",
"legacy"
]
}
}))
return dao.saveCollection(collection)
})

View File

@ -0,0 +1,311 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("4kshuv7r3jdrst4")
// remove
collection.schema.removeField("3a7rml1j")
// remove
collection.schema.removeField("bnl6ad4i")
// remove
collection.schema.removeField("ksygfdso")
// remove
collection.schema.removeField("n0umiou7")
// remove
collection.schema.removeField("uejrddgg")
// remove
collection.schema.removeField("bnpzoaia")
// remove
collection.schema.removeField("9bbzqjjn")
// remove
collection.schema.removeField("vsmepkpt")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "qugcmaci",
"name": "username",
"type": "text",
"required": false,
"presentable": false,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "xgnr5u6r",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "h6g1fc8q",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"unpaid",
"premium",
"founder",
"flounder",
"legacy"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "vj3sk7kb",
"name": "subscription_interval",
"type": "select",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"month",
"year",
"life"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "xcgqgnta",
"name": "tokenKey",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "qry333wj",
"name": "passwordHash",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "iizbf8aq",
"name": "unsubscribe",
"type": "bool",
"required": false,
"presentable": false,
"unique": false,
"options": {}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "yfjlqgyp",
"name": "s3",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 2000000
}
}))
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("4kshuv7r3jdrst4")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "3a7rml1j",
"name": "username",
"type": "text",
"required": false,
"presentable": false,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "bnl6ad4i",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "ksygfdso",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"premium",
"founder",
"flounder",
"legacy"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "n0umiou7",
"name": "subscription_interval",
"type": "select",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"month",
"year",
"life"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "uejrddgg",
"name": "tokenKey",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "bnpzoaia",
"name": "passwordHash",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "9bbzqjjn",
"name": "unsubscribe",
"type": "bool",
"required": false,
"presentable": false,
"unique": false,
"options": {}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "vsmepkpt",
"name": "s3",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 2000000
}
}))
// remove
collection.schema.removeField("qugcmaci")
// remove
collection.schema.removeField("xgnr5u6r")
// remove
collection.schema.removeField("h6g1fc8q")
// remove
collection.schema.removeField("vj3sk7kb")
// remove
collection.schema.removeField("xcgqgnta")
// remove
collection.schema.removeField("qry333wj")
// remove
collection.schema.removeField("iizbf8aq")
// remove
collection.schema.removeField("yfjlqgyp")
return dao.saveCollection(collection)
})