Skip to content

Commit 2488037

Browse files
authored
Merge pull request #2862 from appwrite/string-update-field
fix - legacy string col not appearing
2 parents 38d4805 + ccb24ba commit 2488037

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/edit.svelte

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import deepEqual from 'deep-equal';
1010
import { addNotification } from '$lib/stores/notifications';
1111
import { type Columns, columnsOrder, databaseColumnSheetOptions } from '../store';
12-
import { columnOptions, type Option } from './store';
12+
import { columnOptions, STRING_COLUMN_NAME, type Option } from './store';
1313
import { onMount } from 'svelte';
1414
import { Layout } from '@appwrite.io/pink-svelte';
1515
import { preferences } from '$lib/stores/preferences';
@@ -34,14 +34,21 @@
3434
}
3535
});
3636
37-
$: option = columnOptions.find((option) => {
38-
if (selectedColumn) {
39-
if ('format' in selectedColumn && selectedColumn.format) {
40-
return option?.format === selectedColumn?.format;
41-
} else {
42-
return option?.type === selectedColumn?.type;
43-
}
37+
$: option = columnOptions.find((opt) => {
38+
if (!selectedColumn) return false;
39+
40+
// format match when present
41+
if ('format' in selectedColumn && selectedColumn.format) {
42+
return opt?.format === selectedColumn.format;
4443
}
44+
45+
// Legacy string columns (no format)
46+
if (selectedColumn.type === 'string') {
47+
return opt.name === STRING_COLUMN_NAME;
48+
}
49+
50+
// Fallback: match by type
51+
return opt.type === selectedColumn.type;
4552
}) as Option;
4653
4754
export async function submit() {

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/store.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export type Option = {
8585
icon: ComponentType;
8686
};
8787

88+
export const STRING_COLUMN_NAME = 'String (deprecated)';
89+
8890
export const columnOptions: Option[] = [
8991
{
9092
name: 'Text',
@@ -235,7 +237,7 @@ export const columnOptions: Option[] = [
235237
icon: IconRelationship
236238
},
237239
{
238-
name: 'String (deprecated)',
240+
name: STRING_COLUMN_NAME,
239241
sentenceName: 'string',
240242
component: String,
241243
type: 'string',

0 commit comments

Comments
 (0)