enh: mothership user field validation

This commit is contained in:
Ben Allfree 2024-11-10 17:44:52 -08:00
parent 3abcc093ed
commit 4d9ed9ded2
3 changed files with 508 additions and 0 deletions

View File

@ -0,0 +1,178 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("s00x84jumfjcuvc")
// remove
collection.schema.removeField("nxduzx8j")
// remove
collection.schema.removeField("uxypjefe")
// remove
collection.schema.removeField("2eksisrf")
// remove
collection.schema.removeField("9vsfyoqa")
// 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"
]
}
}))
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("s00x84jumfjcuvc")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "nxduzx8j",
"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": "uxypjefe",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "2eksisrf",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"premium",
"lifetime",
"founder",
"legacy"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "9vsfyoqa",
"name": "subscription_interval",
"type": "select",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"month",
"year",
"life"
]
}
}))
// remove
collection.schema.removeField("kij3qt2u")
// remove
collection.schema.removeField("cwdyzhim")
// remove
collection.schema.removeField("ou52evzg")
// remove
collection.schema.removeField("shuxbcrz")
return dao.saveCollection(collection)
})

View File

@ -0,0 +1,54 @@
/// <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",
"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",
"lifetime",
"founder",
"legacy"
]
}
}))
return dao.saveCollection(collection)
})

View File

@ -0,0 +1,276 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("4kshuv7r3jdrst4")
// remove
collection.schema.removeField("fec2cbfb")
// remove
collection.schema.removeField("tytnadtb")
// remove
collection.schema.removeField("juickogz")
// remove
collection.schema.removeField("e5tbaqub")
// remove
collection.schema.removeField("lzoyncmi")
// remove
collection.schema.removeField("p5hwwwd1")
// remove
collection.schema.removeField("mswqajfw")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "lgcb0lnr",
"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": "uis8woxw",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "6dbuvkcr",
"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": "nrmbdf15",
"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": "bjws5smi",
"name": "tokenKey",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "dlh0pf9o",
"name": "passwordHash",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "baky64ne",
"name": "unsubscribe",
"type": "bool",
"required": false,
"presentable": false,
"unique": false,
"options": {}
}))
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("4kshuv7r3jdrst4")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "fec2cbfb",
"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": "tytnadtb",
"name": "email",
"type": "email",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "juickogz",
"name": "subscription",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 1,
"values": [
"free",
"premium",
"lifetime",
"founder",
"legacy"
]
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "e5tbaqub",
"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": "lzoyncmi",
"name": "tokenKey",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "p5hwwwd1",
"name": "passwordHash",
"type": "json",
"required": false,
"presentable": false,
"unique": false,
"options": {
"maxSize": 1
}
}))
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "mswqajfw",
"name": "unsubscribe",
"type": "bool",
"required": false,
"presentable": false,
"unique": false,
"options": {}
}))
// remove
collection.schema.removeField("lgcb0lnr")
// remove
collection.schema.removeField("uis8woxw")
// remove
collection.schema.removeField("6dbuvkcr")
// remove
collection.schema.removeField("nrmbdf15")
// remove
collection.schema.removeField("bjws5smi")
// remove
collection.schema.removeField("dlh0pf9o")
// remove
collection.schema.removeField("baky64ne")
return dao.saveCollection(collection)
})