chore: remove 'platform' field

This commit is contained in:
Ben Allfree 2023-06-10 02:32:47 -07:00
parent 96825b8769
commit b4a68f99fa
6 changed files with 102 additions and 14 deletions

View File

@ -14,7 +14,6 @@ export type BackupFields = BaseFields & {
status: BackupStatus
message: string
bytes: number
platform: string
version: string
progress: {
[_: string]: number
@ -23,18 +22,12 @@ export type BackupFields = BaseFields & {
export type BackupFields_Create = Pick<
BackupFields,
'instanceId' | 'status' | 'platform' | 'version'
'instanceId' | 'status' | 'version'
>
export type BackupFields_Update = Partial<
Pick<
BackupFields,
| 'instanceId'
| 'status'
| 'bytes'
| 'message'
| 'platform'
| 'version'
| 'progress'
'instanceId' | 'status' | 'bytes' | 'message' | 'version' | 'progress'
>
>

View File

@ -1,7 +1,6 @@
import { BaseFields, RecordId, Seconds, Subdomain, UserId } from './types'
export type VersionId = string
export type PlatformId = string
export enum InstanceStatus {
Unknown = '',
@ -22,7 +21,6 @@ export type InstanceFields = BaseFields & {
subdomain: Subdomain
uid: UserId
status: InstanceStatus
platform: PlatformId
version: VersionId
secondsThisMonth: Seconds
isBackupAllowed: boolean

View File

@ -0,0 +1,67 @@
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv")
collection.indexes = [
"CREATE UNIQUE INDEX `idx_unique_qdtuuld1` ON `instances` (`subdomain`)"
]
// remove
collection.schema.removeField("yxby5r6b")
// update
collection.schema.addField(new SchemaField({
"system": false,
"id": "qdtuuld1",
"name": "subdomain",
"type": "text",
"required": true,
"unique": false,
"options": {
"min": null,
"max": 50,
"pattern": "^[a-z][\\-a-z]+$"
}
}))
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv")
collection.indexes = [
"CREATE UNIQUE INDEX \"idx_unique_qdtuuld1\" on \"instances\" (\"subdomain\")"
]
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "yxby5r6b",
"name": "platform",
"type": "text",
"required": true,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}))
// update
collection.schema.addField(new SchemaField({
"system": false,
"id": "qdtuuld1",
"name": "subdomain",
"type": "text",
"required": true,
"unique": true,
"options": {
"min": null,
"max": 50,
"pattern": "^[a-z][\\-a-z]+$"
}
}))
return dao.saveCollection(collection)
})

View File

@ -0,0 +1,29 @@
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("72clb6v41bzsay9")
// remove
collection.schema.removeField("4lmammjz")
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("72clb6v41bzsay9")
// add
collection.schema.addField(new SchemaField({
"system": false,
"id": "4lmammjz",
"name": "platform",
"type": "text",
"required": true,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}))
return dao.saveCollection(collection)
})

View File

@ -27,11 +27,10 @@ export const createBackupMixin = (context: MixinContext) => {
if (!instance) {
throw new Error(`Expected ${instanceId} to be a valid instance`)
}
const { platform, version } = instance
const { version } = instance
const rec: BackupFields_Create = {
instanceId,
status: BackupStatus.Queued,
platform,
version,
}
const created = await client

View File

@ -141,7 +141,9 @@ By default, PocketHost will download and run the latest version of PocketBase. I
- Fix: FTP now correctly downloads static assets
- Fix: FTP now accesses `pb_migrations`
- Fix: Secrets CSS light/dark mode fixes
- **0.7.0**
- Chore: remove `platform` field from instances and backups
**0.7.0**
- PocketHost will now always select and run the latest version of PocketBase for new instances and for the PocketHost central database. This was previously restricted until PocketBase matured more, but we think it is safe now.
- Now using native PocketBase migrations to manage PocketHost central database migrations. Roadmap has been updated with task to allow end users to put their PocketBase instance in maintenance mode and run migrations.