Skip to content

Commit

Permalink
fix: column renaming errors (#1231)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexis Rico <[email protected]>
  • Loading branch information
eemmiillyy and SferaDev authored Nov 2, 2023
1 parent 19c5dd4 commit 786fc78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-waves-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@xata.io/cli": patch
---

fix: column renaming errors
4 changes: 2 additions & 2 deletions cli/src/commands/schema/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ vectorDimension: \${vectorDimension}
name: column?.name || '',
type: column?.type || '',
link: isColumnAdded ? '' : column?.link?.table,
vectorDimension: column?.vector?.dimension ? `${column?.vector?.dimension}` : '',
vectorDimension: column?.vector?.dimension ? `${column?.vector?.dimension}` : undefined,
notNull: column?.notNull ? 'true' : 'false',
defaultValue: column?.defaultValue || '',
unique: column?.unique ? 'true' : 'false',
Expand Down Expand Up @@ -863,7 +863,7 @@ function parseDefaultValue(type: string, val?: string): string | undefined {
const num = String(val).length > 0 ? +val : undefined;

if (['text', 'string'].includes(type)) {
return String(val);
return val === '' ? undefined : String(val);
} else if (type === 'int') {
return Number.isSafeInteger(num) && val !== '' ? String(num) : undefined;
} else if (type === 'float') {
Expand Down

0 comments on commit 786fc78

Please sign in to comment.