feat(schema): add workspaceId to 11 tables missing from Drizzle ORM (organizations, tasks, goals, decisions, transactions, documents, opportunities, observations, ai_requests, research_briefs, saved_segments)
This commit is contained in:
parent
f5ac5f11f1
commit
21c6ff2fde
1 changed files with 11 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ import {
|
|||
export const organizations = pgTable('organizations', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
name: text('name').notNull(),
|
||||
legalName: text('legal_name'),
|
||||
country: text('country'),
|
||||
|
|
@ -42,6 +43,7 @@ export const transactionEvidenceStatus = pgEnum('transaction_evidence_status', [
|
|||
export const transactions = pgTable('transactions', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
organizationId: uuid('organization_id').notNull(),
|
||||
type: text('type').notNull(),
|
||||
amountMinorUnits: numeric('amount_minor_units', { precision: 18, scale: 0 }).notNull(),
|
||||
|
|
@ -62,6 +64,7 @@ export const documentClassification = pgEnum('document_classification', ['c0', '
|
|||
export const documents = pgTable('documents', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
organizationId: uuid('organization_id'),
|
||||
ownerUserId: uuid('owner_user_id').notNull(),
|
||||
classification: documentClassification('classification').notNull().default('c2'),
|
||||
|
|
@ -82,6 +85,7 @@ export const taskStatus = pgEnum('task_status', ['open', 'in_progress', 'blocked
|
|||
export const tasks = pgTable('tasks', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
ownerUserId: uuid('owner_user_id').notNull(),
|
||||
title: text('title').notNull(),
|
||||
priority: integer('priority').notNull().default(3),
|
||||
|
|
@ -175,6 +179,7 @@ export const goalStatus = pgEnum('goal_status', ['not_started', 'on_track', 'at_
|
|||
export const goals = pgTable('goals', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
ownerUserId: uuid('owner_user_id').notNull(),
|
||||
horizon: text('horizon').notNull(),
|
||||
metric: text('metric').notNull(),
|
||||
|
|
@ -192,6 +197,7 @@ export const goals = pgTable('goals', {
|
|||
export const decisions = pgTable('decisions', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
ownerUserId: uuid('owner_user_id').notNull(),
|
||||
context: text('context').notNull(),
|
||||
options: jsonb('options').notNull().default([]),
|
||||
|
|
@ -207,6 +213,7 @@ export const decisions = pgTable('decisions', {
|
|||
export const opportunities = pgTable('opportunities', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
source: text('source').notNull(),
|
||||
entityType: text('entity_type'),
|
||||
entityId: text('entity_id'),
|
||||
|
|
@ -230,6 +237,7 @@ export const opportunities = pgTable('opportunities', {
|
|||
export const aiRequests = pgTable('ai_requests', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
requestedByUserId: uuid('requested_by_user_id').notNull(),
|
||||
purpose: text('purpose').notNull(),
|
||||
actionClass: text('action_class').notNull(),
|
||||
|
|
@ -251,6 +259,7 @@ export const aiRequests = pgTable('ai_requests', {
|
|||
export const observations = pgTable('observations', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
subjectType: text('subject_type').notNull(),
|
||||
subjectId: text('subject_id').notNull(),
|
||||
metric: text('metric').notNull(),
|
||||
|
|
@ -590,6 +599,7 @@ export const auditLog = pgTable(
|
|||
export const savedSegments = pgTable('saved_segments', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
createdByUserId: uuid('created_by_user_id').notNull(),
|
||||
name: text('name').notNull(),
|
||||
query: text('query').notNull(),
|
||||
|
|
@ -602,6 +612,7 @@ export const savedSegments = pgTable('saved_segments', {
|
|||
export const researchBriefs = pgTable('research_briefs', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
createdByUserId: uuid('created_by_user_id').notNull(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
organizationName: text('organization_name'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue