add a fix for broken migrate

This commit is contained in:
Nate Kelley 2025-08-04 20:40:36 -06:00
parent 62644bffeb
commit 43af5fdb4d
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
6 changed files with 6849 additions and 4 deletions

View File

@ -1,5 +1,4 @@
import { Hono } from 'hono';
import { requireAuth } from '../../../../middleware/auth';
import GET from './GET';
import PUT from './PUT';
import SHARING from './sharing';

View File

@ -0,0 +1,5 @@
ALTER TABLE "report_files" ADD CONSTRAINT "report_files_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE cascade;
ALTER TABLE "asset_search" ALTER COLUMN "asset_type" SET DATA TYPE text;--> statement-breakpoint
ALTER TABLE "dashboard_files" ALTER COLUMN "content" SET DEFAULT '[]'::jsonb;

File diff suppressed because it is too large Load Diff

View File

@ -610,6 +610,13 @@
"when": 1754342648525,
"tag": "0086_report_table_enum_update",
"breakpoints": true
},
{
"idx": 87,
"version": "7",
"when": 1754359807604,
"tag": "0087_create_report_table_foreign_keys",
"breakpoints": true
}
]
}

View File

@ -38,6 +38,7 @@ export const assetTypeEnum = pgEnum('asset_type_enum', [
'dashboard_file',
'report_file',
]);
// Asset type enum removed - now using text for all asset_type columns
export const dataSourceOnboardingStatusEnum = pgEnum('data_source_onboarding_status_enum', [
'notStarted',
'inProgress',
@ -470,7 +471,8 @@ export const assetSearch = pgTable(
{
id: uuid().defaultRandom().primaryKey().notNull(),
assetId: uuid('asset_id').notNull(),
assetType: assetTypeEnum('asset_type').notNull(),
// The assetType column is a plain string (text), not an enum.
assetType: text('asset_type').notNull(),
content: text().notNull(),
organizationId: uuid('organization_id').notNull(),
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' })
@ -932,7 +934,7 @@ export const dashboardFiles = pgTable(
id: uuid().defaultRandom().primaryKey().notNull(),
name: varchar().notNull(),
fileName: varchar('file_name').notNull(),
content: jsonb().notNull(),
content: jsonb().notNull().default([]),
filter: varchar(),
organizationId: uuid('organization_id').notNull(),
createdBy: uuid('created_by').notNull(),
@ -1059,6 +1061,11 @@ export const reportFiles = pgTable(
foreignColumns: [users.id],
name: 'report_files_workspace_sharing_enabled_by_fkey',
}).onUpdate('cascade'),
foreignKey({
columns: [table.organizationId],
foreignColumns: [organizations.id],
name: 'report_files_organization_id_fkey',
}).onUpdate('cascade'),
]
);

View File

@ -5,7 +5,7 @@
"outDir": "dist",
"rootDir": "src"
},
"include": ["src/**/*", "env.d.ts"],
"include": ["src/**/*", "env.d.ts", "scripts/**/*"],
"exclude": ["node_modules", "dist", "tests", "**/*.test.ts", "**/*.spec.ts"],
"references": [{ "path": "../vitest-config" }]
}