Q101: a connector can hold several labelled company accounts, each granted and used by name
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
736c45c0ee
commit
4a6641fd49
23 files changed
+306
-151
No files matched your search
@@ -0,0 +1,25 @@
|
||||
export const connectorAccountLabelsSchema = `
|
||||
create table connector_accounts_next (
|
||||
id text primary key,
|
||||
org_id text not null references organizations(id) on delete cascade,
|
||||
toolkit_slug text not null,
|
||||
toolkit_name text not null,
|
||||
label text not null,
|
||||
auth_config_id text not null,
|
||||
status text not null,
|
||||
pending_account_id text,
|
||||
created_at text not null,
|
||||
updated_at text not null,
|
||||
unique (org_id, toolkit_slug, label)
|
||||
);
|
||||
insert into connector_accounts_next(id, org_id, toolkit_slug, toolkit_name, label, auth_config_id, status, pending_account_id, created_at, updated_at)
|
||||
select id, org_id, toolkit_slug, toolkit_name, 'main', auth_config_id, status, pending_account_id, created_at, updated_at from connector_accounts;
|
||||
drop table connector_accounts;
|
||||
alter table connector_accounts_next rename to connector_accounts;
|
||||
|
||||
alter table agent_connector_grants add column account_label text not null default 'main';
|
||||
alter table connector_executions add column account_label text not null default 'main';
|
||||
|
||||
insert into schema_migrations(version, name, applied_at)
|
||||
values (83, 'connector_account_labels', datetime('now'));
|
||||
`;
|
||||
@@ -81,6 +81,7 @@ import { eraseRetiredCredentialsSchema } from "./migrations/079-erase-retired-cr
|
||||
import { runCapabilityWarningsSchema } from "./migrations/080-run-capability-warnings";
|
||||
import { connectorExecutionsSchema } from "./migrations/081-connector-executions";
|
||||
import { connectorPendingAccountSchema } from "./migrations/082-connector-pending-account";
|
||||
import { connectorAccountLabelsSchema } from "./migrations/083-connector-account-labels";
|
||||
|
||||
interface Migration {
|
||||
version: number;
|
||||
@@ -171,6 +172,7 @@ const MIGRATIONS: Migration[] = [
|
||||
{ version: 80, name: "run_capability_warnings", sql: runCapabilityWarningsSchema },
|
||||
{ version: 81, name: "connector_executions", sql: connectorExecutionsSchema },
|
||||
{ version: 82, name: "connector_pending_account", sql: connectorPendingAccountSchema },
|
||||
{ version: 83, name: "connector_account_labels", sql: connectorAccountLabelsSchema },
|
||||
];
|
||||
|
||||
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;
|
||||
|
||||
Reference in new issue
Block a user