Revert "refactor: reuse columnDefToTableEditorValuesColumn for default value handling"

This reverts commit bd8f071d9f.
This commit is contained in:
Diego Imbert
2026-03-27 17:27:33 +01:00
parent 2a67b96719
commit 3abb400ba8
@@ -1,11 +1,9 @@
<script module lang="ts">
import {
type TableEditorValues,
type TableEditorValuesColumn,
type TableEditorForeignKey,
columnDefToTableEditorValuesColumn
import type {
TableEditorValues,
TableEditorValuesColumn,
TableEditorForeignKey
} from '$lib/components/apps/components/display/dbtable/tableEditor'
import type { ColumnMetadata } from '$lib/components/apps/components/display/dbtable/utils'
import {
diffTableEditorValues,
type AlterTableValues,
@@ -25,16 +23,14 @@
if (!table || typeof table !== 'object') continue
result[schemaName][tableName] = {
name: table.name ?? tableName,
columns: (table.columns ?? []).map((c: any) =>
columnDefToTableEditorValuesColumn({
field: c.name,
datatype: c.datatype ?? '',
defaultvalue: c.default_value ?? c.defaultValue ?? '',
isprimarykey: c.primary_key ?? c.primaryKey ?? false,
isidentity: 'No',
isnullable: c.nullable === false ? 'NO' : 'YES',
isenum: false
} as ColumnMetadata)
columns: (table.columns ?? []).map(
(c: any): TableEditorValuesColumn => ({
name: c.name,
datatype: c.datatype,
primaryKey: c.primary_key ?? c.primaryKey,
defaultValue: c.default_value ?? c.defaultValue,
nullable: c.nullable
})
),
foreignKeys: (table.foreign_keys ?? table.foreignKeys ?? []).map(
(fk: any): TableEditorForeignKey => ({