plus datasource schema
This commit is contained in:
parent
1d75e13fa2
commit
ca4d976a76
|
@ -66,7 +66,7 @@ exports.find = async function (ctx) {
|
|||
exports.plus = async function (ctx) {
|
||||
const db = new CouchDB(ctx.appId)
|
||||
|
||||
const PlusConnector = plusIntegrations[ctx.request.body.source]
|
||||
const PlusConnector = plusIntegrations[ctx.request.body.source].integration
|
||||
|
||||
const connector = new PlusConnector(ctx.request.body)
|
||||
await connector.init()
|
||||
|
|
|
@ -284,10 +284,12 @@ exports.getWebhookParams = (webhookId = null, otherProps = {}) => {
|
|||
* Generates a new datasource ID.
|
||||
* @returns {string} The new datasource ID which the webhook doc can be stored under.
|
||||
*/
|
||||
exports.generateDatasourceID = ({ plus = false }) => {
|
||||
return `${
|
||||
plus ? DocumentTypes.DATASOURCE_PLUS : DocumentTypes.DATASOURCE
|
||||
}${SEPARATOR}${newid()}`
|
||||
exports.generateDatasourceID = options => {
|
||||
let id = DocumentTypes.DATASOURCE
|
||||
if (options && options.plus) {
|
||||
id = DocumentTypes.DATASOURCE_PLUS
|
||||
}
|
||||
return `${id}${SEPARATOR}${newid()}`
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,8 @@ const airtable = require("./airtable")
|
|||
const mysql = require("./mysql")
|
||||
const arangodb = require("./arangodb")
|
||||
const rest = require("./rest")
|
||||
// Plus
|
||||
const postgresPlus = require("../integrations/plus/postgres")
|
||||
|
||||
const DEFINITIONS = {
|
||||
POSTGRES: postgres.schema,
|
||||
|
@ -22,6 +24,7 @@ const DEFINITIONS = {
|
|||
MYSQL: mysql.schema,
|
||||
ARANGODB: arangodb.schema,
|
||||
REST: rest.schema,
|
||||
POSTGRES_PLUS: postgresPlus.schema,
|
||||
}
|
||||
|
||||
const INTEGRATIONS = {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const { Pool } = require("pg")
|
||||
const { FieldTypes } = require("../../constants")
|
||||
const { FIELD_TYPES } = require("../Integration")
|
||||
|
||||
const TYPE_MAP = {
|
||||
text: FieldTypes.LONGFORM,
|
||||
|
@ -13,6 +14,44 @@ const TYPE_MAP = {
|
|||
boolean: FieldTypes.BOOLEAN,
|
||||
}
|
||||
|
||||
const SCHEMA = {
|
||||
friendlyName: "PostgreSQL",
|
||||
description:
|
||||
"PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
||||
datasource: {
|
||||
host: {
|
||||
type: FIELD_TYPES.STRING,
|
||||
default: "localhost",
|
||||
required: true,
|
||||
},
|
||||
port: {
|
||||
type: FIELD_TYPES.NUMBER,
|
||||
required: true,
|
||||
default: 5432,
|
||||
},
|
||||
database: {
|
||||
type: FIELD_TYPES.STRING,
|
||||
default: "postgres",
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: FIELD_TYPES.STRING,
|
||||
default: "root",
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
type: FIELD_TYPES.PASSWORD,
|
||||
default: "root",
|
||||
required: true,
|
||||
},
|
||||
ssl: {
|
||||
type: FIELD_TYPES.BOOLEAN,
|
||||
default: false,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
class PostgresPlus {
|
||||
static pool
|
||||
COLUMNS_SQL =
|
||||
|
@ -52,4 +91,7 @@ class PostgresPlus {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = PostgresPlus
|
||||
module.exports = {
|
||||
schema: SCHEMA,
|
||||
integration: PostgresPlus,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue