diff --git a/packages/common/src/schema/Backup.ts b/packages/common/src/schema/Backup.ts index c1a4391d..f11be61e 100644 --- a/packages/common/src/schema/Backup.ts +++ b/packages/common/src/schema/Backup.ts @@ -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' > > diff --git a/packages/common/src/schema/Instance.ts b/packages/common/src/schema/Instance.ts index 6535da4c..40a9c0c9 100644 --- a/packages/common/src/schema/Instance.ts +++ b/packages/common/src/schema/Instance.ts @@ -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 diff --git a/packages/daemon/migrations/1686388017_updated_instances.js b/packages/daemon/migrations/1686388017_updated_instances.js new file mode 100644 index 00000000..b619be0d --- /dev/null +++ b/packages/daemon/migrations/1686388017_updated_instances.js @@ -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) +}) diff --git a/packages/daemon/migrations/1686388321_updated_backups.js b/packages/daemon/migrations/1686388321_updated_backups.js new file mode 100644 index 00000000..0e4699db --- /dev/null +++ b/packages/daemon/migrations/1686388321_updated_backups.js @@ -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) +}) diff --git a/packages/daemon/src/services/clientService/BackupMixin.ts b/packages/daemon/src/services/clientService/BackupMixin.ts index 25109723..058411e4 100644 --- a/packages/daemon/src/services/clientService/BackupMixin.ts +++ b/packages/daemon/src/services/clientService/BackupMixin.ts @@ -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 diff --git a/readme.md b/readme.md index c21e2242..4cc67abb 100644 --- a/readme.md +++ b/readme.md @@ -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.