// SPDX-License-Identifier: AGPL-3.0-or-later /// // Workspace integrations (ADR-18): one record per workspace. // // - github, linear, figma: tokens (sealed by docwell-server) that let link // previews read private issues, pull requests and files. // - slack_*: the workspace's own Slack app. slack_bot and slack_signing are // sealed; slack_team is the Slack workspace the bot belongs to; // slack_channel gets the slack_events Docwell posts; slack_unfurl previews // Docwell links in Slack, slack_search answers /docwell. migrate( (app) => { const workspaces = app.findCollectionByNameOrId("workspaces"); app.save( new Collection({ type: "base", name: "workspace_integrations", fields: [ { name: "workspace", type: "relation", collectionId: workspaces.id, maxSelect: 1, required: true, cascadeDelete: true }, { name: "github", type: "text", max: 2000 }, { name: "linear", type: "text", max: 2000 }, { name: "figma", type: "text", max: 2000 }, { name: "slack_bot", type: "text", max: 2000 }, { name: "slack_signing", type: "text", max: 2000 }, { name: "slack_team", type: "text", max: 40 }, { name: "slack_team_name", type: "text", max: 200 }, { name: "slack_channel", type: "text", max: 40 }, { name: "slack_channel_name", type: "text", max: 200 }, { name: "slack_events", type: "json", maxSize: 4000 }, { name: "slack_unfurl", type: "bool" }, { name: "slack_search", type: "bool" }, { name: "slack_error", type: "text", max: 1000 }, { name: "created", type: "autodate", onCreate: true, onUpdate: false }, { name: "updated", type: "autodate", onCreate: true, onUpdate: true }, ], indexes: ["CREATE UNIQUE INDEX idx_workspace_integrations_workspace ON workspace_integrations (workspace)"], }), ); }, (app) => { app.delete(app.findCollectionByNameOrId("workspace_integrations")); }, );