/// /** * `clients` — the companies the developer works for. * * A client owns projects. Client-manager users are scoped to exactly one * client, and that scoping is what stops one customer seeing another's work. */ migrate( (app) => { const collection = new Collection({ name: "clients", type: "base", listRule: "@request.auth.id != ''", viewRule: "@request.auth.id != ''", createRule: null, updateRule: null, deleteRule: null, fields: [ { name: "name", type: "text", required: true, max: 120, presentable: true, }, { name: "slug", type: "text", required: true, max: 60, pattern: "^[a-z0-9-]+$", }, { name: "brand_color", type: "text", required: false, max: 7 }, { name: "active", type: "bool", required: false }, { name: "created", type: "autodate", onCreate: true, onUpdate: false, }, { name: "updated", type: "autodate", onCreate: true, onUpdate: true, }, ], indexes: ["CREATE UNIQUE INDEX idx_clients_slug ON clients (slug)"], }); return app.save(collection); }, (app) => { return app.delete(app.findCollectionByNameOrId("clients")); } );