Merge branch 'feature/opinionated-sql' of github.com:Budibase/budibase into feature/opinionated-sql
This commit is contained in:
commit
ceed5e0c07
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue