1
0
Fork 0
mirror of synced 2024-09-30 09:07:25 +13:00

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 export let value
</script> </script>
<div>{value}</div> <div>{typeof value === "object" ? JSON.stringify(value) : value}</div>
<style> <style>
div { div {

View file

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