fix: store raw API schema in forked_from to avoid double transformation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-03-27 17:05:45 +01:00
parent bd8f071d9f
commit e326197a20

View File

@@ -1,7 +1,6 @@
<script module lang="ts">
import {
type TableEditorValues,
type TableEditorValuesColumn,
type TableEditorForeignKey,
columnDefToTableEditorValuesColumn
} from '$lib/components/apps/components/display/dbtable/tableEditor'
@@ -321,12 +320,17 @@
return
}
// Update forked_from.schema for the migrated table
// Update forked_from.schema for the migrated table using raw API format
try {
const sourceSchema =
drawerDirection === 'ahead' ? drawerDiff.forkSchema : drawerDiff.parentSchema
const targetWorkspace = drawerDirection === 'ahead' ? parentWorkspaceId : currentWorkspaceId
const { schemaName, tableName } = drawerChange
const newTableDef = sourceSchema[schemaName]?.[tableName]
// Re-fetch the raw schema from the target (post-migration) to store as new baseline
const rawSchema = await WorkspaceService.getDatatableFullSchema({
workspace: targetWorkspace,
requestBody: { source: `datatable://${dtName}` }
})
const newTableDef = rawSchema[schemaName]?.[tableName]
const forkSettings = await WorkspaceService.getSettings({
workspace: currentWorkspaceId