Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe(`EmptyBucketModal`, () => {
path: `/platform/storage/:ref/buckets/:id/empty`,
})
// Called by useStorageExplorerStateSnapshot but seems
// to be unnecessary for succesful test?
// to be unnecessary for successful test?
//
// useProjectSettingsV2Query -> ProjectSettings
// GET /platform/projects/:ref/settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,21 @@ export const formatTableRowsToSQL = (table: SupaTable, rows: any[]) => {

// We only check for NULL, array and JSON types, everything else we stringify
// given that Postgres can implicitly cast the right type based on the column type
// For string types, we need to deal with escaping single quotes
const stringFormats = ['text', 'varchar']

if (val === null) {
return 'null'
} else if (dataType === 'ARRAY') {
return `'${JSON.stringify(val).replace('[', '{').replace(/.$/, '}')}'`
} else if (format?.includes('json')) {
return `${JSON.stringify(val).replace(/\\"/g, '"').replace(/'/g, "''").replace('"', "'").replace(/.$/, "'")}`
} else if (
typeof format === 'string' &&
typeof val === 'string' &&
stringFormats.includes(format)
) {
return `'${val.replaceAll("'", "''")}'`
} else {
return `'${val}'`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ const EntityListItem: ItemRenderer<Entity, EntityListItemProps> = ({
connectionString: project?.connectionString,
table: supaTable,
})

const formattedRows = rows.map((row) => {
const formattedRow = row
Object.keys(row).map((column) => {
if (typeof row[column] === 'object' && row[column] !== null)
formattedRow[column] = JSON.stringify(formattedRow[column])
const formattedRow = { ...row }
Object.keys(row).forEach((column) => {
if (typeof row[column] === 'object' && row[column] !== null) {
formattedRow[column] = JSON.stringify(row[column])
}
})
return formattedRow
})
Expand Down
Loading