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) {
|
exports.plus = async function (ctx) {
|
||||||
const db = new CouchDB(ctx.appId)
|
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)
|
const connector = new PlusConnector(ctx.request.body)
|
||||||
await connector.init()
|
await connector.init()
|
||||||
|
|
|
@ -284,10 +284,12 @@ exports.getWebhookParams = (webhookId = null, otherProps = {}) => {
|
||||||
* Generates a new datasource ID.
|
* Generates a new datasource ID.
|
||||||
* @returns {string} The new datasource ID which the webhook doc can be stored under.
|
* @returns {string} The new datasource ID which the webhook doc can be stored under.
|
||||||
*/
|
*/
|
||||||
exports.generateDatasourceID = ({ plus = false }) => {
|
exports.generateDatasourceID = options => {
|
||||||
return `${
|
let id = DocumentTypes.DATASOURCE
|
||||||
plus ? DocumentTypes.DATASOURCE_PLUS : DocumentTypes.DATASOURCE
|
if (options && options.plus) {
|
||||||
}${SEPARATOR}${newid()}`
|
id = DocumentTypes.DATASOURCE_PLUS
|
||||||
|
}
|
||||||
|
return `${id}${SEPARATOR}${newid()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@ const airtable = require("./airtable")
|
||||||
const mysql = require("./mysql")
|
const mysql = require("./mysql")
|
||||||
const arangodb = require("./arangodb")
|
const arangodb = require("./arangodb")
|
||||||
const rest = require("./rest")
|
const rest = require("./rest")
|
||||||
|
// Plus
|
||||||
|
const postgresPlus = require("../integrations/plus/postgres")
|
||||||
|
|
||||||
const DEFINITIONS = {
|
const DEFINITIONS = {
|
||||||
POSTGRES: postgres.schema,
|
POSTGRES: postgres.schema,
|
||||||
|
@ -22,6 +24,7 @@ const DEFINITIONS = {
|
||||||
MYSQL: mysql.schema,
|
MYSQL: mysql.schema,
|
||||||
ARANGODB: arangodb.schema,
|
ARANGODB: arangodb.schema,
|
||||||
REST: rest.schema,
|
REST: rest.schema,
|
||||||
|
POSTGRES_PLUS: postgresPlus.schema,
|
||||||
}
|
}
|
||||||
|
|
||||||
const INTEGRATIONS = {
|
const INTEGRATIONS = {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { Pool } = require("pg")
|
const { Pool } = require("pg")
|
||||||
const { FieldTypes } = require("../../constants")
|
const { FieldTypes } = require("../../constants")
|
||||||
|
const { FIELD_TYPES } = require("../Integration")
|
||||||
|
|
||||||
const TYPE_MAP = {
|
const TYPE_MAP = {
|
||||||
text: FieldTypes.LONGFORM,
|
text: FieldTypes.LONGFORM,
|
||||||
|
@ -13,6 +14,44 @@ const TYPE_MAP = {
|
||||||
boolean: FieldTypes.BOOLEAN,
|
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 {
|
class PostgresPlus {
|
||||||
static pool
|
static pool
|
||||||
COLUMNS_SQL =
|
COLUMNS_SQL =
|
||||||
|
@ -52,4 +91,7 @@ class PostgresPlus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PostgresPlus
|
module.exports = {
|
||||||
|
schema: SCHEMA,
|
||||||
|
integration: PostgresPlus,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue