Record provider auth sessions
This commit is contained in:
1 parent
216d485c58
commit
648544114a
16 files changed
+280
-14
No files matched your search
@@ -0,0 +1,27 @@
|
||||
export const providerAuthSessionsSchema = `
|
||||
create table if not exists provider_auth_sessions (
|
||||
id text primary key,
|
||||
org_id text not null references organizations(id) on delete cascade,
|
||||
provider_id text not null references providers(id) on delete cascade,
|
||||
provider_key text not null,
|
||||
employee_id text not null references employees(id) on delete cascade,
|
||||
state text not null,
|
||||
nonce text not null,
|
||||
code_verifier_sha256 text not null,
|
||||
redirect_uri text not null,
|
||||
sign_in_url text not null,
|
||||
partition text not null,
|
||||
created_at text not null,
|
||||
expires_at text not null,
|
||||
completed_at text,
|
||||
unique(provider_id, state)
|
||||
);
|
||||
|
||||
create index if not exists idx_provider_auth_sessions_org_provider
|
||||
on provider_auth_sessions(org_id, provider_id, created_at);
|
||||
create index if not exists idx_provider_auth_sessions_employee
|
||||
on provider_auth_sessions(org_id, employee_id, created_at);
|
||||
|
||||
insert into schema_migrations(version, name, applied_at)
|
||||
values (34, 'provider_auth_sessions', datetime('now'));
|
||||
`;
|
||||
@@ -32,6 +32,7 @@ import { approvalSourceRefsSchema } from "./migrations/030-approval-source-refs"
|
||||
import { providerRequestWorkspaceSchema } from "./migrations/031-provider-request-workspace";
|
||||
import { browserActionMetadataSchema } from "./migrations/032-browser-action-metadata";
|
||||
import { auditEventImmutabilitySchema } from "./migrations/033-audit-event-immutability";
|
||||
import { providerAuthSessionsSchema } from "./migrations/034-provider-auth-sessions";
|
||||
|
||||
interface Migration {
|
||||
version: number;
|
||||
@@ -73,6 +74,7 @@ const MIGRATIONS: Migration[] = [
|
||||
{ version: 31, name: "provider_request_workspace", sql: providerRequestWorkspaceSchema },
|
||||
{ version: 32, name: "browser_action_metadata", sql: browserActionMetadataSchema },
|
||||
{ version: 33, name: "audit_event_immutability", sql: auditEventImmutabilitySchema },
|
||||
{ version: 34, name: "provider_auth_sessions", sql: providerAuthSessionsSchema },
|
||||
];
|
||||
|
||||
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;
|
||||
|
||||
Reference in new issue
Block a user