Quick fixes for types.

This commit is contained in:
mike12345567 2021-06-15 19:57:41 +01:00
parent 1a09d09bc8
commit 1f818cf42f
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@
export let value
</script>
<div>{value}</div>
<div>{typeof value === "object" ? JSON.stringify(value) : value}</div>
<style>
div {

View File

@ -14,6 +14,7 @@ const TYPE_MAP = {
timestamp: FieldTypes.DATETIME,
time: FieldTypes.DATETIME,
boolean: FieldTypes.BOOLEAN,
json: FIELD_TYPES.JSON,
}
const SCHEMA = {
@ -87,7 +88,7 @@ class PostgresPlus extends Sql {
try {
const primaryKeysResponse = await this.client.query(this.PRIMARY_KEYS_SQL)
for (let table of primaryKeysResponse.rows) {
keys.push(table.column_name)
keys.push(table.column_name || table.primary_key)
}
} catch (err) {
// TODO: this try catch method isn't right
@ -114,7 +115,7 @@ class PostgresPlus extends Sql {
tables[tableName].schema[columnName] = {
name: columnName,
type: TYPE_MAP[column.data_type],
type: TYPE_MAP[column.data_type] || FIELD_TYPES.STRING,
}
}
this.tables = tables